Source Code Cross Referenced for TransportationNode.java in  » Science » Cougaar12_4 » org » cougaar » glm » ldm » asset » 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.asset 
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:        /* hand generated! */
028:
029:        package org.cougaar.glm.ldm.asset;
030:
031:        import java.beans.IntrospectionException;
032:        import java.beans.PropertyDescriptor;
033:        import java.io.IOException;
034:        import java.io.ObjectInputStream;
035:        import java.io.ObjectOutputStream;
036:        import java.util.Vector;
037:
038:        import org.cougaar.glm.ldm.plan.GeolocLocation;
039:        import org.cougaar.planning.ldm.asset.Asset;
040:        import org.cougaar.planning.ldm.measure.Latitude;
041:        import org.cougaar.planning.ldm.measure.Longitude;
042:
043:        public class TransportationNode extends Facility {
044:            // Instance Variables
045:            private transient String myDescription = "";
046:            private transient GeolocLocation myGeolocLocation;
047:            private transient Vector myLinks;
048:            private transient AirportPG myAirportPG;
049:            private transient RailTerminalPG myRailTerminalPG;
050:            private transient RepairDepotPG myRepairDepotPG;
051:            private transient SeaportPG mySeaportPG;
052:            private transient SupplyDepotPG mySupplyDepotPG;
053:
054:            /** 
055:             * Constructor with no arguments.
056:             */
057:            public TransportationNode() {
058:                this (null, null, new Vector(), null, null, null, null, null);
059:            }
060:
061:            /** 
062:             * A constructor which clones an input node.
063:             */
064:            public TransportationNode(TransportationNode newnode) {
065:                super (newnode);
066:                myDescription = "";
067:                myGeolocLocation = null;
068:                myLinks = new Vector();
069:                myAirportPG = null;
070:                myRailTerminalPG = null;
071:                myRepairDepotPG = null;
072:                mySeaportPG = null;
073:                mySupplyDepotPG = null;
074:            }
075:
076:            /** 
077:             * A constructor taking all the arguments.
078:             */
079:            public TransportationNode(String description,
080:                    GeolocLocation position, Vector links, AirportPG airport,
081:                    RailTerminalPG railterminal, RepairDepotPG repairdepot,
082:                    SeaportPG seaport, SupplyDepotPG supplydepot) {
083:                myDescription = description;
084:                myGeolocLocation = position;
085:                myLinks = links;
086:                myAirportPG = airport;
087:                myRailTerminalPG = railterminal;
088:                myRepairDepotPG = repairdepot;
089:                mySeaportPG = seaport;
090:                mySupplyDepotPG = supplydepot;
091:            }
092:
093:            /** For infrastructure only - use LdmFactory.copyInstance instead. **/
094:            public Object clone() throws CloneNotSupportedException {
095:                TransportationNode _thing = (TransportationNode) super .clone();
096:                if (myDescription != null)
097:                    _thing.setDescription(myDescription);
098:                if (myGeolocLocation != null)
099:                    _thing.setGeolocLocation(myGeolocLocation);
100:                if (myLinks != null)
101:                    _thing.setLinks(myLinks);
102:                if (myAirportPG != null)
103:                    _thing.setAirportPG(myAirportPG);
104:                if (myRailTerminalPG != null)
105:                    _thing.setRailTerminalPG(myRailTerminalPG);
106:                if (myRepairDepotPG != null)
107:                    _thing.setRepairDepotPG(myRepairDepotPG);
108:                if (mySeaportPG != null)
109:                    _thing.setSeaportPG(mySeaportPG);
110:                if (mySupplyDepotPG != null)
111:                    _thing.setSupplyDepotPG(mySupplyDepotPG);
112:                return _thing;
113:            }
114:
115:            /** create an instance of the right class for copy operations **/
116:            public Asset instanceForCopy() {
117:                return new TransportationNode();
118:            }
119:
120:            /** create an instance of this prototype **/
121:            public Asset createInstance() {
122:                return new TransportationNode(this );
123:            }
124:
125:            protected void fillAllPropertyGroups(Vector v) {
126:                super .fillAllPropertyGroups(v);
127:                v.addElement(myAirportPG);
128:                v.addElement(myRailTerminalPG);
129:                v.addElement(myRepairDepotPG);
130:                v.addElement(mySeaportPG);
131:                v.addElement(mySupplyDepotPG);
132:            }
133:
134:            /** 
135:             * Get the descriptive string for this node.
136:             * @return String
137:             */
138:            public String getDescription() {
139:                return myDescription;
140:            }
141:
142:            public GeolocLocation getGeolocLocation() {
143:                return myGeolocLocation;
144:            }
145:
146:            public Vector getLinks() {
147:                return myLinks;
148:            }
149:
150:            public int getNumLinks() {
151:                return myLinks.size();
152:            }
153:
154:            public AirportPG getAirport() {
155:                return myAirportPG;
156:            }
157:
158:            public RailTerminalPG getRailTerminal() {
159:                return myRailTerminalPG;
160:            }
161:
162:            public RepairDepotPG getRepairDepot() {
163:                return myRepairDepotPG;
164:            }
165:
166:            public SeaportPG getSeaport() {
167:                return mySeaportPG;
168:            }
169:
170:            public SupplyDepotPG getSupplyDepot() {
171:                return mySupplyDepotPG;
172:            }
173:
174:            // Set
175:            public void setDescription(String description) {
176:                myDescription = description;
177:            }
178:
179:            public void setGeolocLocation(GeolocLocation position) {
180:                myGeolocLocation = position;
181:            }
182:
183:            public void setLinks(Vector links) {
184:                myLinks = links;
185:            }
186:
187:            public void addLink(TransportationLink link) {
188:                myLinks.addElement(link);
189:            }
190:
191:            public boolean removeLink(TransportationLink link) {
192:                return myLinks.removeElement(link);
193:            }
194:
195:            public void setAirport(AirportPG airport) {
196:                myAirportPG = airport;
197:            }
198:
199:            public void setRailTerminal(RailTerminalPG railterminal) {
200:                myRailTerminalPG = railterminal;
201:            }
202:
203:            public void setRepairDepot(RepairDepotPG repairdepot) {
204:                myRepairDepotPG = repairdepot;
205:            }
206:
207:            public void setSeaport(SeaportPG seaport) {
208:                mySeaportPG = seaport;
209:            }
210:
211:            public void setSupplyDepot(SupplyDepotPG supplydepot) {
212:                mySupplyDepotPG = supplydepot;
213:            }
214:
215:            // Methods
216:            public boolean inside(Latitude maxlat, Latitude minlat,
217:                    Longitude maxlong, Longitude minlong) {
218:                return (myGeolocLocation.getLatitude().getDegrees() <= maxlat
219:                        .getDegrees()
220:                        && myGeolocLocation.getLatitude().getDegrees() >= minlat
221:                                .getDegrees()
222:                        && myGeolocLocation.getLongitude().getDegrees() <= maxlong
223:                                .getDegrees() && myGeolocLocation
224:                        .getLongitude().getDegrees() >= minlong.getDegrees());
225:            }
226:
227:            // Reading/Writing 
228:            private void writeObject(ObjectOutputStream out) throws IOException {
229:                out.defaultWriteObject();
230:                out.writeObject(myAirportPG);
231:                out.writeObject(myGeolocLocation);
232:                out.writeObject(myRailTerminalPG);
233:                out.writeObject(myRepairDepotPG);
234:                out.writeObject(mySeaportPG);
235:                out.writeObject(mySupplyDepotPG);
236:                out.writeObject(myLinks);
237:                out.writeObject(myDescription);
238:            }
239:
240:            private void readObject(ObjectInputStream in)
241:                    throws ClassNotFoundException, IOException {
242:                in.defaultReadObject();
243:                myAirportPG = (AirportPG) in.readObject();
244:                myGeolocLocation = (GeolocLocation) in.readObject();
245:                myRailTerminalPG = (RailTerminalPG) in.readObject();
246:                myRepairDepotPG = (RepairDepotPG) in.readObject();
247:                mySeaportPG = (SeaportPG) in.readObject();
248:                mySupplyDepotPG = (SupplyDepotPG) in.readObject();
249:                myLinks = (Vector) in.readObject();
250:                myDescription = (String) in.readObject();
251:            }
252:
253:            // beaninfo support
254:            private static PropertyDescriptor properties[];
255:            static {
256:                try {
257:                    properties = new PropertyDescriptor[9];
258:                    properties[0] = new PropertyDescriptor("FacilityPG",
259:                            TransportationNode.class, "getFacilityPG", null);
260:                    properties[1] = new PropertyDescriptor("AirportPG",
261:                            TransportationNode.class, "getAirportPG", null);
262:                    properties[2] = new PropertyDescriptor("GeolocLocation",
263:                            TransportationNode.class, "getGeolocLocation", null);
264:                    properties[3] = new PropertyDescriptor("RailTerminalPG",
265:                            TransportationNode.class, "getRailTerminalPG", null);
266:                    properties[4] = new PropertyDescriptor("RepairDepotPG",
267:                            TransportationNode.class, "getRepairDepotPG", null);
268:                    properties[5] = new PropertyDescriptor("SeaportPG",
269:                            TransportationNode.class, "getSeaportPG", null);
270:                    properties[6] = new PropertyDescriptor("SupplyDepotPG",
271:                            TransportationNode.class, "getSupplyDepotPG", null);
272:                    properties[7] = new PropertyDescriptor("Links",
273:                            TransportationNode.class, "getLinks", null);
274:                    properties[8] = new PropertyDescriptor("Description",
275:                            TransportationNode.class, "getDescription", null);
276:                } catch (IntrospectionException ie) {
277:                }
278:            }
279:
280:            public PropertyDescriptor[] getPropertyDescriptors() {
281:                PropertyDescriptor[] pds = super .getPropertyDescriptors();
282:                PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 9];
283:                System.arraycopy(pds, 0, ps, 0, pds.length);
284:                System.arraycopy(properties, 0, ps, pds.length, 9);
285:                return ps;
286:            }
287:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.