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