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 FixedWingAircraftWeapon extends Weapon {
040:
041: public FixedWingAircraftWeapon() {
042: myAirVehiclePG = null;
043: myAirSelfPropulsionPG = null;
044: }
045:
046: public FixedWingAircraftWeapon(FixedWingAircraftWeapon prototype) {
047: super (prototype);
048: myAirVehiclePG = null;
049: myAirSelfPropulsionPG = null;
050: }
051:
052: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
053: public Object clone() throws CloneNotSupportedException {
054: FixedWingAircraftWeapon _thing = (FixedWingAircraftWeapon) super
055: .clone();
056: if (myAirVehiclePG != null)
057: _thing.setAirVehiclePG(myAirVehiclePG.lock());
058: if (myAirSelfPropulsionPG != null)
059: _thing.setAirSelfPropulsionPG(myAirSelfPropulsionPG.lock());
060: return _thing;
061: }
062:
063: /** create an instance of the right class for copy operations **/
064: public Asset instanceForCopy() {
065: return new FixedWingAircraftWeapon();
066: }
067:
068: /** create an instance of this prototype **/
069: public Asset createInstance() {
070: return new FixedWingAircraftWeapon(this );
071: }
072:
073: protected void fillAllPropertyGroups(Vector v) {
074: super .fillAllPropertyGroups(v);
075: {
076: Object _tmp = getAirVehiclePG();
077: if (_tmp != null && !(_tmp instanceof Null_PG)) {
078: v.addElement(_tmp);
079: }
080: }
081: {
082: Object _tmp = getAirSelfPropulsionPG();
083: if (_tmp != null && !(_tmp instanceof Null_PG)) {
084: v.addElement(_tmp);
085: }
086: }
087: }
088:
089: private transient AirVehiclePG myAirVehiclePG;
090:
091: public AirVehiclePG getAirVehiclePG() {
092: AirVehiclePG _tmp = (myAirVehiclePG != null) ? myAirVehiclePG
093: : (AirVehiclePG) resolvePG(AirVehiclePG.class);
094: return (_tmp == AirVehiclePG.nullPG) ? null : _tmp;
095: }
096:
097: public void setAirVehiclePG(PropertyGroup arg_AirVehiclePG) {
098: if (!(arg_AirVehiclePG instanceof AirVehiclePG))
099: throw new IllegalArgumentException(
100: "setAirVehiclePG requires a AirVehiclePG argument.");
101: myAirVehiclePG = (AirVehiclePG) arg_AirVehiclePG;
102: }
103:
104: private transient AirSelfPropulsionPG myAirSelfPropulsionPG;
105:
106: public AirSelfPropulsionPG getAirSelfPropulsionPG() {
107: AirSelfPropulsionPG _tmp = (myAirSelfPropulsionPG != null) ? myAirSelfPropulsionPG
108: : (AirSelfPropulsionPG) resolvePG(AirSelfPropulsionPG.class);
109: return (_tmp == AirSelfPropulsionPG.nullPG) ? null : _tmp;
110: }
111:
112: public void setAirSelfPropulsionPG(
113: PropertyGroup arg_AirSelfPropulsionPG) {
114: if (!(arg_AirSelfPropulsionPG instanceof AirSelfPropulsionPG))
115: throw new IllegalArgumentException(
116: "setAirSelfPropulsionPG requires a AirSelfPropulsionPG argument.");
117: myAirSelfPropulsionPG = (AirSelfPropulsionPG) arg_AirSelfPropulsionPG;
118: }
119:
120: // generic search methods
121: public PropertyGroup getLocalPG(Class c, long t) {
122: if (AirVehiclePG.class.equals(c)) {
123: return (myAirVehiclePG == AirVehiclePG.nullPG) ? null
124: : myAirVehiclePG;
125: }
126: if (AirSelfPropulsionPG.class.equals(c)) {
127: return (myAirSelfPropulsionPG == AirSelfPropulsionPG.nullPG) ? null
128: : myAirSelfPropulsionPG;
129: }
130: return super .getLocalPG(c, t);
131: }
132:
133: public PropertyGroupSchedule getLocalPGSchedule(Class c) {
134: return super .getLocalPGSchedule(c);
135: }
136:
137: public void setLocalPG(Class c, PropertyGroup pg) {
138: if (AirVehiclePG.class.equals(c)) {
139: myAirVehiclePG = (AirVehiclePG) pg;
140: } else if (AirSelfPropulsionPG.class.equals(c)) {
141: myAirSelfPropulsionPG = (AirSelfPropulsionPG) pg;
142: } else
143: super .setLocalPG(c, pg);
144: }
145:
146: public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) {
147: super .setLocalPGSchedule(pgSchedule);
148: }
149:
150: public PropertyGroup removeLocalPG(Class c) {
151: PropertyGroup removed = null;
152: if (AirVehiclePG.class.equals(c)) {
153: removed = myAirVehiclePG;
154: myAirVehiclePG = null;
155: } else if (AirSelfPropulsionPG.class.equals(c)) {
156: removed = myAirSelfPropulsionPG;
157: myAirSelfPropulsionPG = null;
158: } else {
159: removed = super .removeLocalPG(c);
160: }
161: return removed;
162: }
163:
164: public PropertyGroup removeLocalPG(PropertyGroup pg) {
165: Class pgc = pg.getPrimaryClass();
166: if (AirVehiclePG.class.equals(pgc)) {
167: PropertyGroup removed = myAirVehiclePG;
168: myAirVehiclePG = null;
169: return removed;
170: } else if (AirSelfPropulsionPG.class.equals(pgc)) {
171: PropertyGroup removed = myAirSelfPropulsionPG;
172: myAirSelfPropulsionPG = null;
173: return removed;
174: } else {
175: }
176: return super .removeLocalPG(pg);
177: }
178:
179: public PropertyGroupSchedule removeLocalPGSchedule(Class c) {
180: {
181: return super .removeLocalPGSchedule(c);
182: }
183: }
184:
185: public PropertyGroup generateDefaultPG(Class c) {
186: if (AirVehiclePG.class.equals(c)) {
187: return (myAirVehiclePG = new AirVehiclePGImpl());
188: } else if (AirSelfPropulsionPG.class.equals(c)) {
189: return (myAirSelfPropulsionPG = new AirSelfPropulsionPGImpl());
190: } else
191: return super .generateDefaultPG(c);
192: }
193:
194: // dumb serialization methods
195:
196: private void writeObject(ObjectOutputStream out) throws IOException {
197: out.defaultWriteObject();
198: if (myAirVehiclePG instanceof Null_PG
199: || myAirVehiclePG instanceof Future_PG) {
200: out.writeObject(null);
201: } else {
202: out.writeObject(myAirVehiclePG);
203: }
204: if (myAirSelfPropulsionPG instanceof Null_PG
205: || myAirSelfPropulsionPG instanceof Future_PG) {
206: out.writeObject(null);
207: } else {
208: out.writeObject(myAirSelfPropulsionPG);
209: }
210: }
211:
212: private void readObject(ObjectInputStream in)
213: throws ClassNotFoundException, IOException {
214: in.defaultReadObject();
215: myAirVehiclePG = (AirVehiclePG) in.readObject();
216: myAirSelfPropulsionPG = (AirSelfPropulsionPG) in.readObject();
217: }
218:
219: // beaninfo support
220: private static PropertyDescriptor properties[];
221: static {
222: try {
223: properties = new PropertyDescriptor[2];
224: properties[0] = new PropertyDescriptor("AirVehiclePG",
225: FixedWingAircraftWeapon.class, "getAirVehiclePG",
226: null);
227: properties[1] = new PropertyDescriptor(
228: "AirSelfPropulsionPG",
229: FixedWingAircraftWeapon.class,
230: "getAirSelfPropulsionPG", null);
231: } catch (IntrospectionException ie) {
232: }
233: }
234:
235: public PropertyDescriptor[] getPropertyDescriptors() {
236: PropertyDescriptor[] pds = super .getPropertyDescriptors();
237: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 2];
238: System.arraycopy(pds, 0, ps, 0, pds.length);
239: System.arraycopy(properties, 0, ps, pds.length, 2);
240: return ps;
241: }
242: }
|