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:47 EDT 2007 from /u01/builds/cougaar/B12_4/B12_4/070927151721/src/glm/src/org/cougaar/glm/ldm/asset/alpprops.def - DO NOT HAND EDIT */
028: /** Implementation of RepairablePG.
029: * @see RepairablePG
030: * @see NewRepairablePG
031: **/package org.cougaar.glm.ldm.asset;
032:
033: import org.cougaar.planning.ldm.measure.*;
034: import org.cougaar.planning.ldm.asset.*;
035: import org.cougaar.planning.ldm.plan.*;
036: import java.util.*;
037:
038: import org.cougaar.glm.ldm.plan.*;
039: import org.cougaar.glm.ldm.oplan.*;
040: import org.cougaar.glm.ldm.policy.*;
041: import org.cougaar.core.mts.MessageAddress;
042: import org.cougaar.glm.execution.common.InventoryReport;
043:
044: import java.io.ObjectOutputStream;
045: import java.io.ObjectInputStream;
046: import java.io.IOException;
047: import java.beans.PropertyDescriptor;
048: import java.beans.IndexedPropertyDescriptor;
049:
050: public class RepairablePGImpl extends java.beans.SimpleBeanInfo
051: implements NewRepairablePG, Cloneable {
052: public RepairablePGImpl() {
053: }
054:
055: // Slots
056:
057: private double theFailRate;
058:
059: public double getFailRate() {
060: return theFailRate;
061: }
062:
063: public void setFailRate(double fail_rate) {
064: theFailRate = fail_rate;
065: }
066:
067: private String theAcquisitionAdviceCode;
068:
069: public String getAcquisitionAdviceCode() {
070: return theAcquisitionAdviceCode;
071: }
072:
073: public void setAcquisitionAdviceCode(String acquisition_advice_code) {
074: theAcquisitionAdviceCode = acquisition_advice_code;
075: }
076:
077: private String theSupplyStatusCode;
078:
079: public String getSupplyStatusCode() {
080: return theSupplyStatusCode;
081: }
082:
083: public void setSupplyStatusCode(String supply_status_code) {
084: theSupplyStatusCode = supply_status_code;
085: }
086:
087: private String theItemCategoryCode;
088:
089: public String getItemCategoryCode() {
090: return theItemCategoryCode;
091: }
092:
093: public void setItemCategoryCode(String item_category_code) {
094: theItemCategoryCode = item_category_code;
095: }
096:
097: public RepairablePGImpl(RepairablePG original) {
098: theFailRate = original.getFailRate();
099: theAcquisitionAdviceCode = original.getAcquisitionAdviceCode();
100: theSupplyStatusCode = original.getSupplyStatusCode();
101: theItemCategoryCode = original.getItemCategoryCode();
102: }
103:
104: public boolean equals(Object other) {
105:
106: if (!(other instanceof RepairablePG)) {
107: return false;
108: }
109:
110: RepairablePG otherRepairablePG = (RepairablePG) other;
111:
112: if (!(getFailRate() == otherRepairablePG.getFailRate())) {
113: return false;
114: }
115:
116: if (getAcquisitionAdviceCode() == null) {
117: if (otherRepairablePG.getAcquisitionAdviceCode() != null) {
118: return false;
119: }
120: } else if (!(getAcquisitionAdviceCode()
121: .equals(otherRepairablePG.getAcquisitionAdviceCode()))) {
122: return false;
123: }
124:
125: if (getSupplyStatusCode() == null) {
126: if (otherRepairablePG.getSupplyStatusCode() != null) {
127: return false;
128: }
129: } else if (!(getSupplyStatusCode().equals(otherRepairablePG
130: .getSupplyStatusCode()))) {
131: return false;
132: }
133:
134: if (getItemCategoryCode() == null) {
135: if (otherRepairablePG.getItemCategoryCode() != null) {
136: return false;
137: }
138: } else if (!(getItemCategoryCode().equals(otherRepairablePG
139: .getItemCategoryCode()))) {
140: return false;
141: }
142:
143: return true;
144: }
145:
146: public boolean hasDataQuality() {
147: return false;
148: }
149:
150: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
151: return null;
152: }
153:
154: // static inner extension class for real DataQuality Support
155: public final static class DQ extends RepairablePGImpl implements
156: org.cougaar.planning.ldm.dq.NewHasDataQuality {
157: public DQ() {
158: super ();
159: }
160:
161: public DQ(RepairablePG original) {
162: super (original);
163: }
164:
165: public Object clone() {
166: return new DQ(this );
167: }
168:
169: private transient org.cougaar.planning.ldm.dq.DataQuality _dq = null;
170:
171: public boolean hasDataQuality() {
172: return (_dq != null);
173: }
174:
175: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
176: return _dq;
177: }
178:
179: public void setDataQuality(
180: org.cougaar.planning.ldm.dq.DataQuality dq) {
181: _dq = dq;
182: }
183:
184: private void writeObject(ObjectOutputStream out)
185: throws IOException {
186: out.defaultWriteObject();
187: if (out instanceof org.cougaar.core.persist.PersistenceOutputStream)
188: out.writeObject(_dq);
189: }
190:
191: private void readObject(ObjectInputStream in)
192: throws ClassNotFoundException, IOException {
193: in.defaultReadObject();
194: if (in instanceof org.cougaar.core.persist.PersistenceInputStream)
195: _dq = (org.cougaar.planning.ldm.dq.DataQuality) in
196: .readObject();
197: }
198:
199: private final static PropertyDescriptor properties[] = new PropertyDescriptor[1];
200: static {
201: try {
202: properties[0] = new PropertyDescriptor("dataQuality",
203: DQ.class, "getDataQuality", null);
204: } catch (Exception e) {
205: e.printStackTrace();
206: }
207: }
208:
209: public PropertyDescriptor[] getPropertyDescriptors() {
210: PropertyDescriptor[] pds = super .properties;
211: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length
212: + properties.length];
213: System.arraycopy(pds, 0, ps, 0, pds.length);
214: System.arraycopy(properties, 0, ps, pds.length,
215: properties.length);
216: return ps;
217: }
218: }
219:
220: private transient RepairablePG _locked = null;
221:
222: public PropertyGroup lock(Object key) {
223: if (_locked == null)
224: _locked = new _Locked(key);
225: return _locked;
226: }
227:
228: public PropertyGroup lock() {
229: return lock(null);
230: }
231:
232: public NewPropertyGroup unlock(Object key) {
233: return this ;
234: }
235:
236: public Object clone() throws CloneNotSupportedException {
237: return new RepairablePGImpl(RepairablePGImpl.this );
238: }
239:
240: public PropertyGroup copy() {
241: try {
242: return (PropertyGroup) clone();
243: } catch (CloneNotSupportedException cnse) {
244: return null;
245: }
246: }
247:
248: public Class getPrimaryClass() {
249: return primaryClass;
250: }
251:
252: public String getAssetGetMethod() {
253: return assetGetter;
254: }
255:
256: public String getAssetSetMethod() {
257: return assetSetter;
258: }
259:
260: private final static PropertyDescriptor properties[] = new PropertyDescriptor[4];
261: static {
262: try {
263: properties[0] = new PropertyDescriptor("fail_rate",
264: RepairablePG.class, "getFailRate", null);
265: properties[1] = new PropertyDescriptor(
266: "acquisition_advice_code", RepairablePG.class,
267: "getAcquisitionAdviceCode", null);
268: properties[2] = new PropertyDescriptor(
269: "supply_status_code", RepairablePG.class,
270: "getSupplyStatusCode", null);
271: properties[3] = new PropertyDescriptor(
272: "item_category_code", RepairablePG.class,
273: "getItemCategoryCode", null);
274: } catch (Exception e) {
275: org.cougaar.util.log.Logging.getLogger(RepairablePG.class)
276: .error("Caught exception", e);
277: }
278: }
279:
280: public PropertyDescriptor[] getPropertyDescriptors() {
281: return properties;
282: }
283:
284: private final class _Locked extends java.beans.SimpleBeanInfo
285: implements RepairablePG, Cloneable, LockedPG {
286: private transient Object theKey = null;
287:
288: _Locked(Object key) {
289: if (this .theKey == null)
290: this .theKey = key;
291: }
292:
293: public _Locked() {
294: }
295:
296: public PropertyGroup lock() {
297: return this ;
298: }
299:
300: public PropertyGroup lock(Object o) {
301: return this ;
302: }
303:
304: public NewPropertyGroup unlock(Object key)
305: throws IllegalAccessException {
306: if (theKey.equals(key)) {
307: return RepairablePGImpl.this ;
308: } else {
309: throw new IllegalAccessException(
310: "unlock: mismatched internal and provided keys!");
311: }
312: }
313:
314: public PropertyGroup copy() {
315: try {
316: return (PropertyGroup) clone();
317: } catch (CloneNotSupportedException cnse) {
318: return null;
319: }
320: }
321:
322: public Object clone() throws CloneNotSupportedException {
323: return new RepairablePGImpl(RepairablePGImpl.this );
324: }
325:
326: public boolean equals(Object object) {
327: return RepairablePGImpl.this .equals(object);
328: }
329:
330: public double getFailRate() {
331: return RepairablePGImpl.this .getFailRate();
332: }
333:
334: public String getAcquisitionAdviceCode() {
335: return RepairablePGImpl.this .getAcquisitionAdviceCode();
336: }
337:
338: public String getSupplyStatusCode() {
339: return RepairablePGImpl.this .getSupplyStatusCode();
340: }
341:
342: public String getItemCategoryCode() {
343: return RepairablePGImpl.this .getItemCategoryCode();
344: }
345:
346: public final boolean hasDataQuality() {
347: return RepairablePGImpl.this .hasDataQuality();
348: }
349:
350: public final org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
351: return RepairablePGImpl.this .getDataQuality();
352: }
353:
354: public Class getPrimaryClass() {
355: return primaryClass;
356: }
357:
358: public String getAssetGetMethod() {
359: return assetGetter;
360: }
361:
362: public String getAssetSetMethod() {
363: return assetSetter;
364: }
365:
366: public PropertyDescriptor[] getPropertyDescriptors() {
367: return properties;
368: }
369:
370: public Class getIntrospectionClass() {
371: return RepairablePGImpl.class;
372: }
373:
374: }
375:
376: }
|