Source Code Cross Referenced for UTILCargoCategoryDecoder.java in  » Science » Cougaar12_4 » org » cougaar » lib » 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.lib.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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