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 Repairable extends ClassIXRepairPart {
040:
041: public Repairable() {
042: myRepairabilityPG = null;
043: myRepairablePG = null;
044: }
045:
046: public Repairable(Repairable prototype) {
047: super (prototype);
048: myRepairabilityPG = null;
049: myRepairablePG = null;
050: }
051:
052: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
053: public Object clone() throws CloneNotSupportedException {
054: Repairable _thing = (Repairable) super .clone();
055: if (myRepairabilityPG != null)
056: _thing.setRepairabilityPG(myRepairabilityPG.lock());
057: if (myRepairablePG != null)
058: _thing.setRepairablePG(myRepairablePG.lock());
059: return _thing;
060: }
061:
062: /** create an instance of the right class for copy operations **/
063: public Asset instanceForCopy() {
064: return new Repairable();
065: }
066:
067: /** create an instance of this prototype **/
068: public Asset createInstance() {
069: return new Repairable(this );
070: }
071:
072: protected void fillAllPropertyGroups(Vector v) {
073: super .fillAllPropertyGroups(v);
074: {
075: Object _tmp = getRepairabilityPG();
076: if (_tmp != null && !(_tmp instanceof Null_PG)) {
077: v.addElement(_tmp);
078: }
079: }
080: {
081: Object _tmp = getRepairablePG();
082: if (_tmp != null && !(_tmp instanceof Null_PG)) {
083: v.addElement(_tmp);
084: }
085: }
086: }
087:
088: private transient RepairabilityPG myRepairabilityPG;
089:
090: public RepairabilityPG getRepairabilityPG() {
091: RepairabilityPG _tmp = (myRepairabilityPG != null) ? myRepairabilityPG
092: : (RepairabilityPG) resolvePG(RepairabilityPG.class);
093: return (_tmp == RepairabilityPG.nullPG) ? null : _tmp;
094: }
095:
096: public void setRepairabilityPG(PropertyGroup arg_RepairabilityPG) {
097: if (!(arg_RepairabilityPG instanceof RepairabilityPG))
098: throw new IllegalArgumentException(
099: "setRepairabilityPG requires a RepairabilityPG argument.");
100: myRepairabilityPG = (RepairabilityPG) arg_RepairabilityPG;
101: }
102:
103: private transient RepairablePG myRepairablePG;
104:
105: public RepairablePG getRepairablePG() {
106: RepairablePG _tmp = (myRepairablePG != null) ? myRepairablePG
107: : (RepairablePG) resolvePG(RepairablePG.class);
108: return (_tmp == RepairablePG.nullPG) ? null : _tmp;
109: }
110:
111: public void setRepairablePG(PropertyGroup arg_RepairablePG) {
112: if (!(arg_RepairablePG instanceof RepairablePG))
113: throw new IllegalArgumentException(
114: "setRepairablePG requires a RepairablePG argument.");
115: myRepairablePG = (RepairablePG) arg_RepairablePG;
116: }
117:
118: // generic search methods
119: public PropertyGroup getLocalPG(Class c, long t) {
120: if (RepairabilityPG.class.equals(c)) {
121: return (myRepairabilityPG == RepairabilityPG.nullPG) ? null
122: : myRepairabilityPG;
123: }
124: if (RepairablePG.class.equals(c)) {
125: return (myRepairablePG == RepairablePG.nullPG) ? null
126: : myRepairablePG;
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 (RepairabilityPG.class.equals(c)) {
137: myRepairabilityPG = (RepairabilityPG) pg;
138: } else if (RepairablePG.class.equals(c)) {
139: myRepairablePG = (RepairablePG) 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 (RepairabilityPG.class.equals(c)) {
151: removed = myRepairabilityPG;
152: myRepairabilityPG = null;
153: } else if (RepairablePG.class.equals(c)) {
154: removed = myRepairablePG;
155: myRepairablePG = 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 (RepairabilityPG.class.equals(pgc)) {
165: PropertyGroup removed = myRepairabilityPG;
166: myRepairabilityPG = null;
167: return removed;
168: } else if (RepairablePG.class.equals(pgc)) {
169: PropertyGroup removed = myRepairablePG;
170: myRepairablePG = 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 (RepairabilityPG.class.equals(c)) {
185: return (myRepairabilityPG = new RepairabilityPGImpl());
186: } else if (RepairablePG.class.equals(c)) {
187: return (myRepairablePG = new RepairablePGImpl());
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 (myRepairabilityPG instanceof Null_PG
197: || myRepairabilityPG instanceof Future_PG) {
198: out.writeObject(null);
199: } else {
200: out.writeObject(myRepairabilityPG);
201: }
202: if (myRepairablePG instanceof Null_PG
203: || myRepairablePG instanceof Future_PG) {
204: out.writeObject(null);
205: } else {
206: out.writeObject(myRepairablePG);
207: }
208: }
209:
210: private void readObject(ObjectInputStream in)
211: throws ClassNotFoundException, IOException {
212: in.defaultReadObject();
213: myRepairabilityPG = (RepairabilityPG) in.readObject();
214: myRepairablePG = (RepairablePG) 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("RepairabilityPG",
223: Repairable.class, "getRepairabilityPG", null);
224: properties[1] = new PropertyDescriptor("RepairablePG",
225: Repairable.class, "getRepairablePG", 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: }
|