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: /* @generated Thu Sep 27 15:21:46 EDT 2007 from /u01/builds/cougaar/B12_4/B12_4/070927151721/src/glm/src/org/cougaar/glm/ldm/asset/alpassets.def - DO NOT HAND EDIT */
028: package org.cougaar.glm.ldm.asset;
029:
030: import org.cougaar.planning.ldm.asset.*;
031: import java.io.ObjectOutputStream;
032: import java.io.ObjectInputStream;
033: import java.io.IOException;
034: import java.util.Vector;
035: import java.beans.PropertyDescriptor;
036: import java.beans.IndexedPropertyDescriptor;
037: import java.beans.IntrospectionException;
038:
039: public class Truck extends CargoVehicle {
040:
041: public Truck() {
042: myGroundSelfPropulsionPG = null;
043: myGroundVehiclePG = null;
044: myTowPG = null;
045: }
046:
047: public Truck(Truck prototype) {
048: super (prototype);
049: myGroundSelfPropulsionPG = null;
050: myGroundVehiclePG = null;
051: myTowPG = null;
052: }
053:
054: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
055: public Object clone() throws CloneNotSupportedException {
056: Truck _thing = (Truck) super .clone();
057: if (myGroundSelfPropulsionPG != null)
058: _thing.setGroundSelfPropulsionPG(myGroundSelfPropulsionPG
059: .lock());
060: if (myGroundVehiclePG != null)
061: _thing.setGroundVehiclePG(myGroundVehiclePG.lock());
062: if (myTowPG != null)
063: _thing.setTowPG(myTowPG.lock());
064: return _thing;
065: }
066:
067: /** create an instance of the right class for copy operations **/
068: public Asset instanceForCopy() {
069: return new Truck();
070: }
071:
072: /** create an instance of this prototype **/
073: public Asset createInstance() {
074: return new Truck(this );
075: }
076:
077: protected void fillAllPropertyGroups(Vector v) {
078: super .fillAllPropertyGroups(v);
079: {
080: Object _tmp = getGroundSelfPropulsionPG();
081: if (_tmp != null && !(_tmp instanceof Null_PG)) {
082: v.addElement(_tmp);
083: }
084: }
085: {
086: Object _tmp = getGroundVehiclePG();
087: if (_tmp != null && !(_tmp instanceof Null_PG)) {
088: v.addElement(_tmp);
089: }
090: }
091: {
092: Object _tmp = getTowPG();
093: if (_tmp != null && !(_tmp instanceof Null_PG)) {
094: v.addElement(_tmp);
095: }
096: }
097: }
098:
099: private transient GroundSelfPropulsionPG myGroundSelfPropulsionPG;
100:
101: public GroundSelfPropulsionPG getGroundSelfPropulsionPG() {
102: GroundSelfPropulsionPG _tmp = (myGroundSelfPropulsionPG != null) ? myGroundSelfPropulsionPG
103: : (GroundSelfPropulsionPG) resolvePG(GroundSelfPropulsionPG.class);
104: return (_tmp == GroundSelfPropulsionPG.nullPG) ? null : _tmp;
105: }
106:
107: public void setGroundSelfPropulsionPG(
108: PropertyGroup arg_GroundSelfPropulsionPG) {
109: if (!(arg_GroundSelfPropulsionPG instanceof GroundSelfPropulsionPG))
110: throw new IllegalArgumentException(
111: "setGroundSelfPropulsionPG requires a GroundSelfPropulsionPG argument.");
112: myGroundSelfPropulsionPG = (GroundSelfPropulsionPG) arg_GroundSelfPropulsionPG;
113: }
114:
115: private transient GroundVehiclePG myGroundVehiclePG;
116:
117: public GroundVehiclePG getGroundVehiclePG() {
118: GroundVehiclePG _tmp = (myGroundVehiclePG != null) ? myGroundVehiclePG
119: : (GroundVehiclePG) resolvePG(GroundVehiclePG.class);
120: return (_tmp == GroundVehiclePG.nullPG) ? null : _tmp;
121: }
122:
123: public void setGroundVehiclePG(PropertyGroup arg_GroundVehiclePG) {
124: if (!(arg_GroundVehiclePG instanceof GroundVehiclePG))
125: throw new IllegalArgumentException(
126: "setGroundVehiclePG requires a GroundVehiclePG argument.");
127: myGroundVehiclePG = (GroundVehiclePG) arg_GroundVehiclePG;
128: }
129:
130: private transient TowPG myTowPG;
131:
132: public TowPG getTowPG() {
133: TowPG _tmp = (myTowPG != null) ? myTowPG
134: : (TowPG) resolvePG(TowPG.class);
135: return (_tmp == TowPG.nullPG) ? null : _tmp;
136: }
137:
138: public void setTowPG(PropertyGroup arg_TowPG) {
139: if (!(arg_TowPG instanceof TowPG))
140: throw new IllegalArgumentException(
141: "setTowPG requires a TowPG argument.");
142: myTowPG = (TowPG) arg_TowPG;
143: }
144:
145: // generic search methods
146: public PropertyGroup getLocalPG(Class c, long t) {
147: if (GroundSelfPropulsionPG.class.equals(c)) {
148: return (myGroundSelfPropulsionPG == GroundSelfPropulsionPG.nullPG) ? null
149: : myGroundSelfPropulsionPG;
150: }
151: if (GroundVehiclePG.class.equals(c)) {
152: return (myGroundVehiclePG == GroundVehiclePG.nullPG) ? null
153: : myGroundVehiclePG;
154: }
155: if (TowPG.class.equals(c)) {
156: return (myTowPG == TowPG.nullPG) ? null : myTowPG;
157: }
158: return super .getLocalPG(c, t);
159: }
160:
161: public PropertyGroupSchedule getLocalPGSchedule(Class c) {
162: return super .getLocalPGSchedule(c);
163: }
164:
165: public void setLocalPG(Class c, PropertyGroup pg) {
166: if (GroundSelfPropulsionPG.class.equals(c)) {
167: myGroundSelfPropulsionPG = (GroundSelfPropulsionPG) pg;
168: } else if (GroundVehiclePG.class.equals(c)) {
169: myGroundVehiclePG = (GroundVehiclePG) pg;
170: } else if (TowPG.class.equals(c)) {
171: myTowPG = (TowPG) pg;
172: } else
173: super .setLocalPG(c, pg);
174: }
175:
176: public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) {
177: super .setLocalPGSchedule(pgSchedule);
178: }
179:
180: public PropertyGroup removeLocalPG(Class c) {
181: PropertyGroup removed = null;
182: if (GroundSelfPropulsionPG.class.equals(c)) {
183: removed = myGroundSelfPropulsionPG;
184: myGroundSelfPropulsionPG = null;
185: } else if (GroundVehiclePG.class.equals(c)) {
186: removed = myGroundVehiclePG;
187: myGroundVehiclePG = null;
188: } else if (TowPG.class.equals(c)) {
189: removed = myTowPG;
190: myTowPG = null;
191: } else {
192: removed = super .removeLocalPG(c);
193: }
194: return removed;
195: }
196:
197: public PropertyGroup removeLocalPG(PropertyGroup pg) {
198: Class pgc = pg.getPrimaryClass();
199: if (GroundSelfPropulsionPG.class.equals(pgc)) {
200: PropertyGroup removed = myGroundSelfPropulsionPG;
201: myGroundSelfPropulsionPG = null;
202: return removed;
203: } else if (GroundVehiclePG.class.equals(pgc)) {
204: PropertyGroup removed = myGroundVehiclePG;
205: myGroundVehiclePG = null;
206: return removed;
207: } else if (TowPG.class.equals(pgc)) {
208: PropertyGroup removed = myTowPG;
209: myTowPG = null;
210: return removed;
211: } else {
212: }
213: return super .removeLocalPG(pg);
214: }
215:
216: public PropertyGroupSchedule removeLocalPGSchedule(Class c) {
217: {
218: return super .removeLocalPGSchedule(c);
219: }
220: }
221:
222: public PropertyGroup generateDefaultPG(Class c) {
223: if (GroundSelfPropulsionPG.class.equals(c)) {
224: return (myGroundSelfPropulsionPG = new GroundSelfPropulsionPGImpl());
225: } else if (GroundVehiclePG.class.equals(c)) {
226: return (myGroundVehiclePG = new GroundVehiclePGImpl());
227: } else if (TowPG.class.equals(c)) {
228: return (myTowPG = new TowPGImpl());
229: } else
230: return super .generateDefaultPG(c);
231: }
232:
233: // dumb serialization methods
234:
235: private void writeObject(ObjectOutputStream out) throws IOException {
236: out.defaultWriteObject();
237: if (myGroundSelfPropulsionPG instanceof Null_PG
238: || myGroundSelfPropulsionPG instanceof Future_PG) {
239: out.writeObject(null);
240: } else {
241: out.writeObject(myGroundSelfPropulsionPG);
242: }
243: if (myGroundVehiclePG instanceof Null_PG
244: || myGroundVehiclePG instanceof Future_PG) {
245: out.writeObject(null);
246: } else {
247: out.writeObject(myGroundVehiclePG);
248: }
249: if (myTowPG instanceof Null_PG || myTowPG instanceof Future_PG) {
250: out.writeObject(null);
251: } else {
252: out.writeObject(myTowPG);
253: }
254: }
255:
256: private void readObject(ObjectInputStream in)
257: throws ClassNotFoundException, IOException {
258: in.defaultReadObject();
259: myGroundSelfPropulsionPG = (GroundSelfPropulsionPG) in
260: .readObject();
261: myGroundVehiclePG = (GroundVehiclePG) in.readObject();
262: myTowPG = (TowPG) in.readObject();
263: }
264:
265: // beaninfo support
266: private static PropertyDescriptor properties[];
267: static {
268: try {
269: properties = new PropertyDescriptor[3];
270: properties[0] = new PropertyDescriptor(
271: "GroundSelfPropulsionPG", Truck.class,
272: "getGroundSelfPropulsionPG", null);
273: properties[1] = new PropertyDescriptor("GroundVehiclePG",
274: Truck.class, "getGroundVehiclePG", null);
275: properties[2] = new PropertyDescriptor("TowPG",
276: Truck.class, "getTowPG", null);
277: } catch (IntrospectionException ie) {
278: }
279: }
280:
281: public PropertyDescriptor[] getPropertyDescriptors() {
282: PropertyDescriptor[] pds = super .getPropertyDescriptors();
283: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 3];
284: System.arraycopy(pds, 0, ps, 0, pds.length);
285: System.arraycopy(properties, 0, ps, pds.length, 3);
286: return ps;
287: }
288: }
|