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