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 CargoShip extends CargoVehicle {
040:
041: public CargoShip() {
042: myTowPG = null;
043: myShipConfigurationPG = null;
044: myWaterSelfPropulsionPG = null;
045: myWaterVehiclePG = null;
046: }
047:
048: public CargoShip(CargoShip prototype) {
049: super (prototype);
050: myTowPG = null;
051: myShipConfigurationPG = null;
052: myWaterSelfPropulsionPG = null;
053: myWaterVehiclePG = null;
054: }
055:
056: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
057: public Object clone() throws CloneNotSupportedException {
058: CargoShip _thing = (CargoShip) super .clone();
059: if (myTowPG != null)
060: _thing.setTowPG(myTowPG.lock());
061: if (myShipConfigurationPG != null)
062: _thing.setShipConfigurationPG(myShipConfigurationPG.lock());
063: if (myWaterSelfPropulsionPG != null)
064: _thing.setWaterSelfPropulsionPG(myWaterSelfPropulsionPG
065: .lock());
066: if (myWaterVehiclePG != null)
067: _thing.setWaterVehiclePG(myWaterVehiclePG.lock());
068: return _thing;
069: }
070:
071: /** create an instance of the right class for copy operations **/
072: public Asset instanceForCopy() {
073: return new CargoShip();
074: }
075:
076: /** create an instance of this prototype **/
077: public Asset createInstance() {
078: return new CargoShip(this );
079: }
080:
081: protected void fillAllPropertyGroups(Vector v) {
082: super .fillAllPropertyGroups(v);
083: {
084: Object _tmp = getTowPG();
085: if (_tmp != null && !(_tmp instanceof Null_PG)) {
086: v.addElement(_tmp);
087: }
088: }
089: {
090: Object _tmp = getShipConfigurationPG();
091: if (_tmp != null && !(_tmp instanceof Null_PG)) {
092: v.addElement(_tmp);
093: }
094: }
095: {
096: Object _tmp = getWaterSelfPropulsionPG();
097: if (_tmp != null && !(_tmp instanceof Null_PG)) {
098: v.addElement(_tmp);
099: }
100: }
101: {
102: Object _tmp = getWaterVehiclePG();
103: if (_tmp != null && !(_tmp instanceof Null_PG)) {
104: v.addElement(_tmp);
105: }
106: }
107: }
108:
109: private transient TowPG myTowPG;
110:
111: public TowPG getTowPG() {
112: TowPG _tmp = (myTowPG != null) ? myTowPG
113: : (TowPG) resolvePG(TowPG.class);
114: return (_tmp == TowPG.nullPG) ? null : _tmp;
115: }
116:
117: public void setTowPG(PropertyGroup arg_TowPG) {
118: if (!(arg_TowPG instanceof TowPG))
119: throw new IllegalArgumentException(
120: "setTowPG requires a TowPG argument.");
121: myTowPG = (TowPG) arg_TowPG;
122: }
123:
124: private transient ShipConfigurationPG myShipConfigurationPG;
125:
126: public ShipConfigurationPG getShipConfigurationPG() {
127: ShipConfigurationPG _tmp = (myShipConfigurationPG != null) ? myShipConfigurationPG
128: : (ShipConfigurationPG) resolvePG(ShipConfigurationPG.class);
129: return (_tmp == ShipConfigurationPG.nullPG) ? null : _tmp;
130: }
131:
132: public void setShipConfigurationPG(
133: PropertyGroup arg_ShipConfigurationPG) {
134: if (!(arg_ShipConfigurationPG instanceof ShipConfigurationPG))
135: throw new IllegalArgumentException(
136: "setShipConfigurationPG requires a ShipConfigurationPG argument.");
137: myShipConfigurationPG = (ShipConfigurationPG) arg_ShipConfigurationPG;
138: }
139:
140: private transient WaterSelfPropulsionPG myWaterSelfPropulsionPG;
141:
142: public WaterSelfPropulsionPG getWaterSelfPropulsionPG() {
143: WaterSelfPropulsionPG _tmp = (myWaterSelfPropulsionPG != null) ? myWaterSelfPropulsionPG
144: : (WaterSelfPropulsionPG) resolvePG(WaterSelfPropulsionPG.class);
145: return (_tmp == WaterSelfPropulsionPG.nullPG) ? null : _tmp;
146: }
147:
148: public void setWaterSelfPropulsionPG(
149: PropertyGroup arg_WaterSelfPropulsionPG) {
150: if (!(arg_WaterSelfPropulsionPG instanceof WaterSelfPropulsionPG))
151: throw new IllegalArgumentException(
152: "setWaterSelfPropulsionPG requires a WaterSelfPropulsionPG argument.");
153: myWaterSelfPropulsionPG = (WaterSelfPropulsionPG) arg_WaterSelfPropulsionPG;
154: }
155:
156: private transient WaterVehiclePG myWaterVehiclePG;
157:
158: public WaterVehiclePG getWaterVehiclePG() {
159: WaterVehiclePG _tmp = (myWaterVehiclePG != null) ? myWaterVehiclePG
160: : (WaterVehiclePG) resolvePG(WaterVehiclePG.class);
161: return (_tmp == WaterVehiclePG.nullPG) ? null : _tmp;
162: }
163:
164: public void setWaterVehiclePG(PropertyGroup arg_WaterVehiclePG) {
165: if (!(arg_WaterVehiclePG instanceof WaterVehiclePG))
166: throw new IllegalArgumentException(
167: "setWaterVehiclePG requires a WaterVehiclePG argument.");
168: myWaterVehiclePG = (WaterVehiclePG) arg_WaterVehiclePG;
169: }
170:
171: // generic search methods
172: public PropertyGroup getLocalPG(Class c, long t) {
173: if (TowPG.class.equals(c)) {
174: return (myTowPG == TowPG.nullPG) ? null : myTowPG;
175: }
176: if (ShipConfigurationPG.class.equals(c)) {
177: return (myShipConfigurationPG == ShipConfigurationPG.nullPG) ? null
178: : myShipConfigurationPG;
179: }
180: if (WaterSelfPropulsionPG.class.equals(c)) {
181: return (myWaterSelfPropulsionPG == WaterSelfPropulsionPG.nullPG) ? null
182: : myWaterSelfPropulsionPG;
183: }
184: if (WaterVehiclePG.class.equals(c)) {
185: return (myWaterVehiclePG == WaterVehiclePG.nullPG) ? null
186: : myWaterVehiclePG;
187: }
188: return super .getLocalPG(c, t);
189: }
190:
191: public PropertyGroupSchedule getLocalPGSchedule(Class c) {
192: return super .getLocalPGSchedule(c);
193: }
194:
195: public void setLocalPG(Class c, PropertyGroup pg) {
196: if (TowPG.class.equals(c)) {
197: myTowPG = (TowPG) pg;
198: } else if (ShipConfigurationPG.class.equals(c)) {
199: myShipConfigurationPG = (ShipConfigurationPG) pg;
200: } else if (WaterSelfPropulsionPG.class.equals(c)) {
201: myWaterSelfPropulsionPG = (WaterSelfPropulsionPG) pg;
202: } else if (WaterVehiclePG.class.equals(c)) {
203: myWaterVehiclePG = (WaterVehiclePG) pg;
204: } else
205: super .setLocalPG(c, pg);
206: }
207:
208: public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) {
209: super .setLocalPGSchedule(pgSchedule);
210: }
211:
212: public PropertyGroup removeLocalPG(Class c) {
213: PropertyGroup removed = null;
214: if (TowPG.class.equals(c)) {
215: removed = myTowPG;
216: myTowPG = null;
217: } else if (ShipConfigurationPG.class.equals(c)) {
218: removed = myShipConfigurationPG;
219: myShipConfigurationPG = null;
220: } else if (WaterSelfPropulsionPG.class.equals(c)) {
221: removed = myWaterSelfPropulsionPG;
222: myWaterSelfPropulsionPG = null;
223: } else if (WaterVehiclePG.class.equals(c)) {
224: removed = myWaterVehiclePG;
225: myWaterVehiclePG = null;
226: } else {
227: removed = super .removeLocalPG(c);
228: }
229: return removed;
230: }
231:
232: public PropertyGroup removeLocalPG(PropertyGroup pg) {
233: Class pgc = pg.getPrimaryClass();
234: if (TowPG.class.equals(pgc)) {
235: PropertyGroup removed = myTowPG;
236: myTowPG = null;
237: return removed;
238: } else if (ShipConfigurationPG.class.equals(pgc)) {
239: PropertyGroup removed = myShipConfigurationPG;
240: myShipConfigurationPG = null;
241: return removed;
242: } else if (WaterSelfPropulsionPG.class.equals(pgc)) {
243: PropertyGroup removed = myWaterSelfPropulsionPG;
244: myWaterSelfPropulsionPG = null;
245: return removed;
246: } else if (WaterVehiclePG.class.equals(pgc)) {
247: PropertyGroup removed = myWaterVehiclePG;
248: myWaterVehiclePG = null;
249: return removed;
250: } else {
251: }
252: return super .removeLocalPG(pg);
253: }
254:
255: public PropertyGroupSchedule removeLocalPGSchedule(Class c) {
256: {
257: return super .removeLocalPGSchedule(c);
258: }
259: }
260:
261: public PropertyGroup generateDefaultPG(Class c) {
262: if (TowPG.class.equals(c)) {
263: return (myTowPG = new TowPGImpl());
264: } else if (ShipConfigurationPG.class.equals(c)) {
265: return (myShipConfigurationPG = new ShipConfigurationPGImpl());
266: } else if (WaterSelfPropulsionPG.class.equals(c)) {
267: return (myWaterSelfPropulsionPG = new WaterSelfPropulsionPGImpl());
268: } else if (WaterVehiclePG.class.equals(c)) {
269: return (myWaterVehiclePG = new WaterVehiclePGImpl());
270: } else
271: return super .generateDefaultPG(c);
272: }
273:
274: // dumb serialization methods
275:
276: private void writeObject(ObjectOutputStream out) throws IOException {
277: out.defaultWriteObject();
278: if (myTowPG instanceof Null_PG || myTowPG instanceof Future_PG) {
279: out.writeObject(null);
280: } else {
281: out.writeObject(myTowPG);
282: }
283: if (myShipConfigurationPG instanceof Null_PG
284: || myShipConfigurationPG instanceof Future_PG) {
285: out.writeObject(null);
286: } else {
287: out.writeObject(myShipConfigurationPG);
288: }
289: if (myWaterSelfPropulsionPG instanceof Null_PG
290: || myWaterSelfPropulsionPG instanceof Future_PG) {
291: out.writeObject(null);
292: } else {
293: out.writeObject(myWaterSelfPropulsionPG);
294: }
295: if (myWaterVehiclePG instanceof Null_PG
296: || myWaterVehiclePG instanceof Future_PG) {
297: out.writeObject(null);
298: } else {
299: out.writeObject(myWaterVehiclePG);
300: }
301: }
302:
303: private void readObject(ObjectInputStream in)
304: throws ClassNotFoundException, IOException {
305: in.defaultReadObject();
306: myTowPG = (TowPG) in.readObject();
307: myShipConfigurationPG = (ShipConfigurationPG) in.readObject();
308: myWaterSelfPropulsionPG = (WaterSelfPropulsionPG) in
309: .readObject();
310: myWaterVehiclePG = (WaterVehiclePG) in.readObject();
311: }
312:
313: // beaninfo support
314: private static PropertyDescriptor properties[];
315: static {
316: try {
317: properties = new PropertyDescriptor[4];
318: properties[0] = new PropertyDescriptor("TowPG",
319: CargoShip.class, "getTowPG", null);
320: properties[1] = new PropertyDescriptor(
321: "ShipConfigurationPG", CargoShip.class,
322: "getShipConfigurationPG", null);
323: properties[2] = new PropertyDescriptor(
324: "WaterSelfPropulsionPG", CargoShip.class,
325: "getWaterSelfPropulsionPG", null);
326: properties[3] = new PropertyDescriptor("WaterVehiclePG",
327: CargoShip.class, "getWaterVehiclePG", null);
328: } catch (IntrospectionException ie) {
329: }
330: }
331:
332: public PropertyDescriptor[] getPropertyDescriptors() {
333: PropertyDescriptor[] pds = super .getPropertyDescriptors();
334: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 4];
335: System.arraycopy(pds, 0, ps, 0, pds.length);
336: System.arraycopy(properties, 0, ps, pds.length, 4);
337: return ps;
338: }
339: }
|