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