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 ClassVIIMajorEndItem extends PhysicalAsset {
040:
041: public ClassVIIMajorEndItem() {
042: myMaintenancePG = null;
043: myMovabilityPG = null;
044: myAssetConsumptionRatePG = null;
045: myMEIPG = null;
046: }
047:
048: public ClassVIIMajorEndItem(ClassVIIMajorEndItem prototype) {
049: super (prototype);
050: myMaintenancePG = null;
051: myMovabilityPG = null;
052: myAssetConsumptionRatePG = null;
053: myMEIPG = null;
054: }
055:
056: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
057: public Object clone() throws CloneNotSupportedException {
058: ClassVIIMajorEndItem _thing = (ClassVIIMajorEndItem) super
059: .clone();
060: if (myMaintenancePG != null)
061: _thing.setMaintenancePG(myMaintenancePG.lock());
062: if (myMovabilityPG != null)
063: _thing.setMovabilityPG(myMovabilityPG.lock());
064: if (myAssetConsumptionRatePG != null)
065: _thing.setAssetConsumptionRatePG(myAssetConsumptionRatePG
066: .lock());
067: if (myMEIPG != null)
068: _thing.setMEIPG(myMEIPG.lock());
069: return _thing;
070: }
071:
072: /** create an instance of the right class for copy operations **/
073: public Asset instanceForCopy() {
074: return new ClassVIIMajorEndItem();
075: }
076:
077: /** create an instance of this prototype **/
078: public Asset createInstance() {
079: return new ClassVIIMajorEndItem(this );
080: }
081:
082: protected void fillAllPropertyGroups(Vector v) {
083: super .fillAllPropertyGroups(v);
084: {
085: Object _tmp = getMaintenancePG();
086: if (_tmp != null && !(_tmp instanceof Null_PG)) {
087: v.addElement(_tmp);
088: }
089: }
090: {
091: Object _tmp = getMovabilityPG();
092: if (_tmp != null && !(_tmp instanceof Null_PG)) {
093: v.addElement(_tmp);
094: }
095: }
096: {
097: Object _tmp = getAssetConsumptionRatePG();
098: if (_tmp != null && !(_tmp instanceof Null_PG)) {
099: v.addElement(_tmp);
100: }
101: }
102: {
103: Object _tmp = getMEIPG();
104: if (_tmp != null && !(_tmp instanceof Null_PG)) {
105: v.addElement(_tmp);
106: }
107: }
108: }
109:
110: private transient MaintenancePG myMaintenancePG;
111:
112: public MaintenancePG getMaintenancePG() {
113: MaintenancePG _tmp = (myMaintenancePG != null) ? myMaintenancePG
114: : (MaintenancePG) resolvePG(MaintenancePG.class);
115: return (_tmp == MaintenancePG.nullPG) ? null : _tmp;
116: }
117:
118: public void setMaintenancePG(PropertyGroup arg_MaintenancePG) {
119: if (!(arg_MaintenancePG instanceof MaintenancePG))
120: throw new IllegalArgumentException(
121: "setMaintenancePG requires a MaintenancePG argument.");
122: myMaintenancePG = (MaintenancePG) arg_MaintenancePG;
123: }
124:
125: private transient MovabilityPG myMovabilityPG;
126:
127: public MovabilityPG getMovabilityPG() {
128: MovabilityPG _tmp = (myMovabilityPG != null) ? myMovabilityPG
129: : (MovabilityPG) resolvePG(MovabilityPG.class);
130: return (_tmp == MovabilityPG.nullPG) ? null : _tmp;
131: }
132:
133: public void setMovabilityPG(PropertyGroup arg_MovabilityPG) {
134: if (!(arg_MovabilityPG instanceof MovabilityPG))
135: throw new IllegalArgumentException(
136: "setMovabilityPG requires a MovabilityPG argument.");
137: myMovabilityPG = (MovabilityPG) arg_MovabilityPG;
138: }
139:
140: private transient AssetConsumptionRatePG myAssetConsumptionRatePG;
141:
142: public AssetConsumptionRatePG getAssetConsumptionRatePG() {
143: AssetConsumptionRatePG _tmp = (myAssetConsumptionRatePG != null) ? myAssetConsumptionRatePG
144: : (AssetConsumptionRatePG) resolvePG(AssetConsumptionRatePG.class);
145: return (_tmp == AssetConsumptionRatePG.nullPG) ? null : _tmp;
146: }
147:
148: public void setAssetConsumptionRatePG(
149: PropertyGroup arg_AssetConsumptionRatePG) {
150: if (!(arg_AssetConsumptionRatePG instanceof AssetConsumptionRatePG))
151: throw new IllegalArgumentException(
152: "setAssetConsumptionRatePG requires a AssetConsumptionRatePG argument.");
153: myAssetConsumptionRatePG = (AssetConsumptionRatePG) arg_AssetConsumptionRatePG;
154: }
155:
156: private transient MEIPG myMEIPG;
157:
158: public MEIPG getMEIPG() {
159: MEIPG _tmp = (myMEIPG != null) ? myMEIPG
160: : (MEIPG) resolvePG(MEIPG.class);
161: return (_tmp == MEIPG.nullPG) ? null : _tmp;
162: }
163:
164: public void setMEIPG(PropertyGroup arg_MEIPG) {
165: if (!(arg_MEIPG instanceof MEIPG))
166: throw new IllegalArgumentException(
167: "setMEIPG requires a MEIPG argument.");
168: myMEIPG = (MEIPG) arg_MEIPG;
169: }
170:
171: // generic search methods
172: public PropertyGroup getLocalPG(Class c, long t) {
173: if (MaintenancePG.class.equals(c)) {
174: return (myMaintenancePG == MaintenancePG.nullPG) ? null
175: : myMaintenancePG;
176: }
177: if (MovabilityPG.class.equals(c)) {
178: return (myMovabilityPG == MovabilityPG.nullPG) ? null
179: : myMovabilityPG;
180: }
181: if (AssetConsumptionRatePG.class.equals(c)) {
182: return (myAssetConsumptionRatePG == AssetConsumptionRatePG.nullPG) ? null
183: : myAssetConsumptionRatePG;
184: }
185: if (MEIPG.class.equals(c)) {
186: return (myMEIPG == MEIPG.nullPG) ? null : myMEIPG;
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 (MaintenancePG.class.equals(c)) {
197: myMaintenancePG = (MaintenancePG) pg;
198: } else if (MovabilityPG.class.equals(c)) {
199: myMovabilityPG = (MovabilityPG) pg;
200: } else if (AssetConsumptionRatePG.class.equals(c)) {
201: myAssetConsumptionRatePG = (AssetConsumptionRatePG) pg;
202: } else if (MEIPG.class.equals(c)) {
203: myMEIPG = (MEIPG) 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 (MaintenancePG.class.equals(c)) {
215: removed = myMaintenancePG;
216: myMaintenancePG = null;
217: } else if (MovabilityPG.class.equals(c)) {
218: removed = myMovabilityPG;
219: myMovabilityPG = null;
220: } else if (AssetConsumptionRatePG.class.equals(c)) {
221: removed = myAssetConsumptionRatePG;
222: myAssetConsumptionRatePG = null;
223: } else if (MEIPG.class.equals(c)) {
224: removed = myMEIPG;
225: myMEIPG = 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 (MaintenancePG.class.equals(pgc)) {
235: PropertyGroup removed = myMaintenancePG;
236: myMaintenancePG = null;
237: return removed;
238: } else if (MovabilityPG.class.equals(pgc)) {
239: PropertyGroup removed = myMovabilityPG;
240: myMovabilityPG = null;
241: return removed;
242: } else if (AssetConsumptionRatePG.class.equals(pgc)) {
243: PropertyGroup removed = myAssetConsumptionRatePG;
244: myAssetConsumptionRatePG = null;
245: return removed;
246: } else if (MEIPG.class.equals(pgc)) {
247: PropertyGroup removed = myMEIPG;
248: myMEIPG = 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 (MaintenancePG.class.equals(c)) {
263: return (myMaintenancePG = new MaintenancePGImpl());
264: } else if (MovabilityPG.class.equals(c)) {
265: return (myMovabilityPG = new MovabilityPGImpl());
266: } else if (AssetConsumptionRatePG.class.equals(c)) {
267: return (myAssetConsumptionRatePG = new AssetConsumptionRatePGImpl());
268: } else if (MEIPG.class.equals(c)) {
269: return (myMEIPG = new MEIPGImpl());
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 (myMaintenancePG instanceof Null_PG
279: || myMaintenancePG instanceof Future_PG) {
280: out.writeObject(null);
281: } else {
282: out.writeObject(myMaintenancePG);
283: }
284: if (myMovabilityPG instanceof Null_PG
285: || myMovabilityPG instanceof Future_PG) {
286: out.writeObject(null);
287: } else {
288: out.writeObject(myMovabilityPG);
289: }
290: if (myAssetConsumptionRatePG instanceof Null_PG
291: || myAssetConsumptionRatePG instanceof Future_PG) {
292: out.writeObject(null);
293: } else {
294: out.writeObject(myAssetConsumptionRatePG);
295: }
296: if (myMEIPG instanceof Null_PG || myMEIPG instanceof Future_PG) {
297: out.writeObject(null);
298: } else {
299: out.writeObject(myMEIPG);
300: }
301: }
302:
303: private void readObject(ObjectInputStream in)
304: throws ClassNotFoundException, IOException {
305: in.defaultReadObject();
306: myMaintenancePG = (MaintenancePG) in.readObject();
307: myMovabilityPG = (MovabilityPG) in.readObject();
308: myAssetConsumptionRatePG = (AssetConsumptionRatePG) in
309: .readObject();
310: myMEIPG = (MEIPG) 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("MaintenancePG",
319: ClassVIIMajorEndItem.class, "getMaintenancePG",
320: null);
321: properties[1] = new PropertyDescriptor("MovabilityPG",
322: ClassVIIMajorEndItem.class, "getMovabilityPG", null);
323: properties[2] = new PropertyDescriptor(
324: "AssetConsumptionRatePG",
325: ClassVIIMajorEndItem.class,
326: "getAssetConsumptionRatePG", null);
327: properties[3] = new PropertyDescriptor("MEIPG",
328: ClassVIIMajorEndItem.class, "getMEIPG", null);
329: } catch (IntrospectionException ie) {
330: }
331: }
332:
333: public PropertyDescriptor[] getPropertyDescriptors() {
334: PropertyDescriptor[] pds = super .getPropertyDescriptors();
335: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 4];
336: System.arraycopy(pds, 0, ps, 0, pds.length);
337: System.arraycopy(properties, 0, ps, pds.length, 4);
338: return ps;
339: }
340: }
|