Source Code Cross Referenced for CargoCategoryDecoder.java in  » Science » Cougaar12_4 » org » cougaar » glm » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.glm.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // 
002:        /*
003:         * <copyright>
004:         *  
005:         *  Copyright 1997-2004 BBNT Solutions, LLC
006:         *  under sponsorship of the Defense Advanced Research Projects
007:         *  Agency (DARPA).
008:         * 
009:         *  You can redistribute this software and/or modify it under the
010:         *  terms of the Cougaar Open Source License as published on the
011:         *  Cougaar Open Source Website (www.cougaar.org).
012:         * 
013:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
014:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
015:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
016:         *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
017:         *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
018:         *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
019:         *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
020:         *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
021:         *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
022:         *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
023:         *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
024:         *  
025:         * </copyright>
026:         */
027:
028:        package org.cougaar.glm.util;
029:
030:        /**
031:         * Static class to extract some information out
032:         * of the cargo category codes.
033:         * Cargo category codes are 3 letter codes that define
034:         * how a piece of cargo can be transported from point A 
035:         * to point B.
036:         */
037:        public final class CargoCategoryDecoder {
038:
039:            /**
040:             * See if the cargo is air transportable.
041:             * @param code - 3 letter cargo category code
042:             * @return boolean
043:             */
044:            public static boolean AirTransportable(String code) {
045:                code = code.toUpperCase();
046:                char c = code.charAt(1);
047:                return ((c != '0') && (c != '4') && (c != 'A'));
048:            }
049:
050:            /** 
051:             * See if cargo is outsized.
052:             * @param code - 3 letter cargo category code
053:             * @return boolean
054:             */
055:
056:            public static boolean isOutsized(String code) {
057:                code = code.toUpperCase();
058:                char c = code.charAt(1);
059:                return ((c == '1') || (c == '5') || (c == 'B'));
060:            }
061:
062:            /** 
063:             * See if cargo is oversized.
064:             * @param code - 3 letter cargo category code
065:             * @return boolean
066:             */
067:
068:            public static boolean isOversized(String code) {
069:                code = code.toUpperCase();
070:                char c = code.charAt(1);
071:                return ((c == '2') || (c == '6') || (c == 'C'));
072:            }
073:
074:            /**
075:             * See if the cargo fits on a C5 or a C17 Plane.
076:             * There is a limit to outsize a C17 can carry.  This info
077:             * can not be deduced from the cargo category code and must
078:             * be found using the length and width info. in ContainCapability.java.
079:             * @param code - 3 letter cargo category code
080:             * @return boolean
081:             */
082:
083:            public static boolean FitsOnC5orC17(String code) {
084:                code = code.toUpperCase();
085:                char c = code.charAt(1);
086:                // only bulk organic and oversized 
087:                // and outsized equipment
088:                return (FitsOnAnyPlane(code) || FitsOnC17orC141(code)
089:                        || c == '1' || c == '5' || c == 'B');
090:            }
091:
092:            /**
093:             * See if the cargo fits on a C17 or C141 plane
094:             * @param code - 3 letter cargo category code
095:             * @return boolean
096:             */
097:            public static boolean FitsOnC17orC141(String code) {
098:                code = code.toUpperCase();
099:                char c = code.charAt(1);
100:                // only bulk organic and oversized equipment
101:                return (FitsOnAnyPlane(code) || c == '2' || c == '6' || c == 'C');
102:            }
103:
104:            /**
105:             * See if the cargo fits on any kind of US Military 
106:             * cargo plane.
107:             * @param code - 3 letter cargo category code
108:             * @return boolean
109:             */
110:            public static boolean FitsOnAnyPlane(String code) {
111:                code = code.toUpperCase();
112:                char c = code.charAt(1);
113:                // bulk or organic cargo
114:                return (c == '3' || c == '7' || c == 'D' || c == '8' || c == '9');
115:            }
116:
117:            /**
118:             * See if the cargo can go by ship.  For
119:             * the 1998 demo we will assume that anything
120:             * can go by ship.
121:             * @param code - 3 letter cargo category code
122:             * @return boolean
123:             */
124:            public static boolean FitsOnShip(String code) {
125:                return true;
126:            }
127:
128:            /**
129:             * Can be transported down american roads, if not then 
130:             * it must go by train.
131:             * @param code - 3 letter cargo category code
132:             * @return boolean
133:             */
134:            public static boolean IsRoadable(String code) {
135:                code = code.toUpperCase();
136:                char c = code.charAt(0);
137:                return (c != 'A');
138:            }
139:
140:            /**
141:             * Roadable vehicles, may be hazardouz, may require security
142:             * @param code - 3 letter cargo category code
143:             * @return boolean
144:             */
145:            public static boolean IsSelfTransportable(String code) {
146:                code = code.toUpperCase();
147:                char c = code.charAt(0);
148:                return (c == 'K' || c == 'L' || c == 'R');
149:            }
150:
151:            /**
152:             * Cargo can be put in a 20 ft container
153:             * @param code - 3 letter cargo category code
154:             * @return boolean
155:             */
156:            public static boolean Is20FtContainarizable(String code) {
157:                code = code.toUpperCase();
158:                char c = code.charAt(2);
159:                return (c == 'B');
160:            }
161:
162:            /**
163:             * Cargo can be put in a 20 ft container
164:             * @param code - 3 letter cargo category code
165:             * @return boolean
166:             */
167:            public static boolean Is40FtContainarizable(String code) {
168:                code = code.toUpperCase();
169:                char c = code.charAt(2);
170:                return (c == 'C');
171:            }
172:
173:            /**
174:             * See if some cargo can be transported by train
175:             * For the 1998 demo we assume that all vehicles are
176:             * trainable.
177:             * @param code - 3 letter cargo category code
178:             * @return boolean
179:             */
180:            public static boolean IsTrainable(String code) {
181:                return true;
182:            }
183:
184:            /**
185:             * See if we are a Roll on Roll off vehicle
186:             * @param code - 3 letter cargo category code
187:             * @return boolean
188:             **/
189:            public static boolean isRORO(String code) {
190:                code = code.toUpperCase();
191:                char c = code.charAt(0);
192:                return c == 'A' || c == 'K' || c == 'L' || c == 'R';
193:            }
194:
195:            /**
196:             * See if we are Ammo
197:             * @param code - 3 letter cargo category code
198:             * @return boolean
199:             **/
200:            public static boolean isAmmo(String code) {
201:                code = code.toUpperCase();
202:                char c = code.charAt(0);
203:                return c == 'M' || c == 'N' || c == 'P';
204:            }
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.