Source Code Cross Referenced for Skill.java in  » Science » Cougaar12_4 » org » cougaar » glm » ldm » plan » 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.ldm.plan 
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.glm.ldm.plan;
028:
029:        import java.io.IOException;
030:        import java.io.ObjectInputStream;
031:        import java.io.Serializable;
032:
033:        import org.cougaar.util.UnaryPredicate;
034:
035:        /** Abstract Representation of a personal skill or capability.
036:         * Examples of Skills:
037:         *  MOS/11B = INFANTRYMAN:        Army Enlisted: Military Occupational Speciality
038:         *  ASI/B4  = SNIPER:             Army Enlisted: Additional Skill Identifier
039:         *  SQI/P   = PARACHUTIST:        Army Enlisted: Special Qualification IDentifier
040:         *  AOC/15A = AVIATION, GENERAL:  Army Commissioned Officer: AreaOfConcentration
041:         *  OSC/B2  = UH­60 PILOT:        Army Commissioned Officer: Officer Skill Codes
042:         **/
043:
044:        public class Skill implements  Serializable {
045:            protected String type; // eg "MOS"
046:            protected String code; // eg "11B" 
047:            protected String nomenclature; // eg "INFANTRYMAN: Army Enlisted: Military Occupational"
048:
049:            public String getType() {
050:                return type;
051:            }
052:
053:            public String getCode() {
054:                return code;
055:            }
056:
057:            public String getNomenclature() {
058:                return nomenclature;
059:            }
060:
061:            /** empty constructor for use by subs, which will need to fill out 
062:             * type, code, nomenclature members themselves.
063:             **/
064:            protected Skill() {
065:            }
066:
067:            /** 
068:             * @param type Skill class, e.g. MOS, ASI, AOC, SQI, etc.
069:             * @param code Skill code, e.g. 11B, B4, P, etc
070:             * @param nomenclature Human-readable description of skill, may be null.
071:             **/
072:            public Skill(String type, String code, String nomenclature) {
073:                this .type = type.intern();
074:                this .code = code.intern();
075:                this .nomenclature = nomenclature;
076:            }
077:
078:            /** equivalent to Skill(type, code, null). **/
079:            public Skill(String type, String code) {
080:                this (type, code, null);
081:            }
082:
083:            /** parser constructor: expects "TYPE/CODE[/NOMENCLATURE]" **/
084:            public Skill(String s) {
085:                int s1 = s.indexOf('/');
086:                if (s1 == -1)
087:                    throw new IllegalArgumentException("Invalid Skill syntax: "
088:                            + s);
089:                int s2 = s.indexOf('/', s1 + 1);
090:                String t = s.substring(0, s1);
091:                String c;
092:                String n = null;
093:                if (s2 == -1) {
094:                    c = s.substring(s1 + 1);
095:                } else {
096:                    c = s.substring(s1 + 1, s2);
097:                    n = s.substring(s2 + 1);
098:                }
099:                this .type = t.intern();
100:                this .code = c.intern();
101:                this .nomenclature = n;
102:
103:            }
104:
105:            /** alternate parser constructor **/
106:            public static Skill newSkill(String s) {
107:                return new Skill(s);
108:            }
109:
110:            /** @return "TYPE/CODE" **/
111:            public String toString() {
112:                return type + "/" + code;
113:            }
114:
115:            /** @return true iff type and code are the same. **/
116:            public boolean equals(Object s) {
117:                if (s.getClass() == this .getClass()) { // must be exact class!
118:                    Skill os = (Skill) s;
119:                    // we can use == because type and code are always interned
120:                    return (type == os.getType() && code == os.getCode());
121:                } else {
122:                    return false;
123:                }
124:            }
125:
126:            public int hashCode() {
127:                return type.hashCode() + code.hashCode();
128:            }
129:
130:            // make sure type and code remain interned.
131:            private void readObject(ObjectInputStream stream)
132:                    throws ClassNotFoundException, IOException {
133:                stream.defaultReadObject();
134:                type = type.intern();
135:                code = code.intern();
136:            }
137:
138:            // some utility predicates for Skill types:
139:            // Note that the use of == instead of .equals is both intentional 
140:            // and safe: the types are interned and string literals are always
141:            // interned.
142:            /** A Predicate which selects for MOS skill type **/
143:            public static final UnaryPredicate mosP = new UnaryPredicate() {
144:                public boolean execute(Object o) {
145:                    return (o instanceof  Skill && ((Skill) o).getType() == "MOS");
146:                }
147:            };
148:            /** A Predicate which selects for Aircrew skill type **/
149:            public static final UnaryPredicate aircrewP = new UnaryPredicate() {
150:                public boolean execute(Object o) {
151:                    return (o instanceof  Skill && ((Skill) o).getType() == "Aircrew");
152:                }
153:            };
154:            /** A Predicate which selects for ASI skill type **/
155:            public static final UnaryPredicate asiP = new UnaryPredicate() {
156:                public boolean execute(Object o) {
157:                    return (o instanceof  Skill && ((Skill) o).getType() == "ASI");
158:                }
159:            };
160:            /** A Predicate which selects for SQI skill type **/
161:            public static final UnaryPredicate sqiP = new UnaryPredicate() {
162:                public boolean execute(Object o) {
163:                    return (o instanceof  Skill && ((Skill) o).getType() == "SQI");
164:                }
165:            };
166:            /** A Predicate which selects for AOC skill type **/
167:            public static final UnaryPredicate aocP = new UnaryPredicate() {
168:                public boolean execute(Object o) {
169:                    return (o instanceof  Skill && ((Skill) o).getType() == "AOC");
170:                }
171:            };
172:            /** A Predicate which selects for OSC skill type **/
173:            public static final UnaryPredicate oscP = new UnaryPredicate() {
174:                public boolean execute(Object o) {
175:                    return (o instanceof  Skill && ((Skill) o).getType() == "OSC");
176:                }
177:            };
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.