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 TrainEngine extends CargoVehicle {
040:
041: public TrainEngine() {
042: myRailVehiclePG = null;
043: myRailSelfPropulsionPG = null;
044: myTowPG = null;
045: }
046:
047: public TrainEngine(TrainEngine prototype) {
048: super (prototype);
049: myRailVehiclePG = null;
050: myRailSelfPropulsionPG = 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: TrainEngine _thing = (TrainEngine) super .clone();
057: if (myRailVehiclePG != null)
058: _thing.setRailVehiclePG(myRailVehiclePG.lock());
059: if (myRailSelfPropulsionPG != null)
060: _thing.setRailSelfPropulsionPG(myRailSelfPropulsionPG
061: .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 TrainEngine();
070: }
071:
072: /** create an instance of this prototype **/
073: public Asset createInstance() {
074: return new TrainEngine(this );
075: }
076:
077: protected void fillAllPropertyGroups(Vector v) {
078: super .fillAllPropertyGroups(v);
079: {
080: Object _tmp = getRailVehiclePG();
081: if (_tmp != null && !(_tmp instanceof Null_PG)) {
082: v.addElement(_tmp);
083: }
084: }
085: {
086: Object _tmp = getRailSelfPropulsionPG();
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 RailVehiclePG myRailVehiclePG;
100:
101: public RailVehiclePG getRailVehiclePG() {
102: RailVehiclePG _tmp = (myRailVehiclePG != null) ? myRailVehiclePG
103: : (RailVehiclePG) resolvePG(RailVehiclePG.class);
104: return (_tmp == RailVehiclePG.nullPG) ? null : _tmp;
105: }
106:
107: public void setRailVehiclePG(PropertyGroup arg_RailVehiclePG) {
108: if (!(arg_RailVehiclePG instanceof RailVehiclePG))
109: throw new IllegalArgumentException(
110: "setRailVehiclePG requires a RailVehiclePG argument.");
111: myRailVehiclePG = (RailVehiclePG) arg_RailVehiclePG;
112: }
113:
114: private transient RailSelfPropulsionPG myRailSelfPropulsionPG;
115:
116: public RailSelfPropulsionPG getRailSelfPropulsionPG() {
117: RailSelfPropulsionPG _tmp = (myRailSelfPropulsionPG != null) ? myRailSelfPropulsionPG
118: : (RailSelfPropulsionPG) resolvePG(RailSelfPropulsionPG.class);
119: return (_tmp == RailSelfPropulsionPG.nullPG) ? null : _tmp;
120: }
121:
122: public void setRailSelfPropulsionPG(
123: PropertyGroup arg_RailSelfPropulsionPG) {
124: if (!(arg_RailSelfPropulsionPG instanceof RailSelfPropulsionPG))
125: throw new IllegalArgumentException(
126: "setRailSelfPropulsionPG requires a RailSelfPropulsionPG argument.");
127: myRailSelfPropulsionPG = (RailSelfPropulsionPG) arg_RailSelfPropulsionPG;
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 (RailVehiclePG.class.equals(c)) {
148: return (myRailVehiclePG == RailVehiclePG.nullPG) ? null
149: : myRailVehiclePG;
150: }
151: if (RailSelfPropulsionPG.class.equals(c)) {
152: return (myRailSelfPropulsionPG == RailSelfPropulsionPG.nullPG) ? null
153: : myRailSelfPropulsionPG;
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 (RailVehiclePG.class.equals(c)) {
167: myRailVehiclePG = (RailVehiclePG) pg;
168: } else if (RailSelfPropulsionPG.class.equals(c)) {
169: myRailSelfPropulsionPG = (RailSelfPropulsionPG) 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 (RailVehiclePG.class.equals(c)) {
183: removed = myRailVehiclePG;
184: myRailVehiclePG = null;
185: } else if (RailSelfPropulsionPG.class.equals(c)) {
186: removed = myRailSelfPropulsionPG;
187: myRailSelfPropulsionPG = 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 (RailVehiclePG.class.equals(pgc)) {
200: PropertyGroup removed = myRailVehiclePG;
201: myRailVehiclePG = null;
202: return removed;
203: } else if (RailSelfPropulsionPG.class.equals(pgc)) {
204: PropertyGroup removed = myRailSelfPropulsionPG;
205: myRailSelfPropulsionPG = 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 (RailVehiclePG.class.equals(c)) {
224: return (myRailVehiclePG = new RailVehiclePGImpl());
225: } else if (RailSelfPropulsionPG.class.equals(c)) {
226: return (myRailSelfPropulsionPG = new RailSelfPropulsionPGImpl());
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 (myRailVehiclePG instanceof Null_PG
238: || myRailVehiclePG instanceof Future_PG) {
239: out.writeObject(null);
240: } else {
241: out.writeObject(myRailVehiclePG);
242: }
243: if (myRailSelfPropulsionPG instanceof Null_PG
244: || myRailSelfPropulsionPG instanceof Future_PG) {
245: out.writeObject(null);
246: } else {
247: out.writeObject(myRailSelfPropulsionPG);
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: myRailVehiclePG = (RailVehiclePG) in.readObject();
260: myRailSelfPropulsionPG = (RailSelfPropulsionPG) in.readObject();
261: myTowPG = (TowPG) in.readObject();
262: }
263:
264: // beaninfo support
265: private static PropertyDescriptor properties[];
266: static {
267: try {
268: properties = new PropertyDescriptor[3];
269: properties[0] = new PropertyDescriptor("RailVehiclePG",
270: TrainEngine.class, "getRailVehiclePG", null);
271: properties[1] = new PropertyDescriptor(
272: "RailSelfPropulsionPG", TrainEngine.class,
273: "getRailSelfPropulsionPG", null);
274: properties[2] = new PropertyDescriptor("TowPG",
275: TrainEngine.class, "getTowPG", null);
276: } catch (IntrospectionException ie) {
277: }
278: }
279:
280: public PropertyDescriptor[] getPropertyDescriptors() {
281: PropertyDescriptor[] pds = super .getPropertyDescriptors();
282: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 3];
283: System.arraycopy(pds, 0, ps, 0, pds.length);
284: System.arraycopy(properties, 0, ps, pds.length, 3);
285: return ps;
286: }
287: }
|