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