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 CostPG.
029: * @see CostPG
030: * @see NewCostPG
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 CostPGImpl extends java.beans.SimpleBeanInfo implements
051: NewCostPG, Cloneable {
052: public CostPGImpl() {
053: }
054:
055: // Slots
056:
057: private CostRate thePerDiemCost;
058:
059: public CostRate getPerDiemCost() {
060: return thePerDiemCost;
061: }
062:
063: public void setPerDiemCost(CostRate per_diem_cost) {
064: thePerDiemCost = per_diem_cost;
065: }
066:
067: private double theBreakOutCost;
068:
069: public double getBreakOutCost() {
070: return theBreakOutCost;
071: }
072:
073: public void setBreakOutCost(double break_out_cost) {
074: theBreakOutCost = break_out_cost;
075: }
076:
077: public CostPGImpl(CostPG original) {
078: thePerDiemCost = original.getPerDiemCost();
079: theBreakOutCost = original.getBreakOutCost();
080: }
081:
082: public boolean equals(Object other) {
083:
084: if (!(other instanceof CostPG)) {
085: return false;
086: }
087:
088: CostPG otherCostPG = (CostPG) other;
089:
090: if (getPerDiemCost() == null) {
091: if (otherCostPG.getPerDiemCost() != null) {
092: return false;
093: }
094: } else if (!(getPerDiemCost().equals(otherCostPG
095: .getPerDiemCost()))) {
096: return false;
097: }
098:
099: if (!(getBreakOutCost() == otherCostPG.getBreakOutCost())) {
100: return false;
101: }
102:
103: return true;
104: }
105:
106: public boolean hasDataQuality() {
107: return false;
108: }
109:
110: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
111: return null;
112: }
113:
114: // static inner extension class for real DataQuality Support
115: public final static class DQ extends CostPGImpl implements
116: org.cougaar.planning.ldm.dq.NewHasDataQuality {
117: public DQ() {
118: super ();
119: }
120:
121: public DQ(CostPG original) {
122: super (original);
123: }
124:
125: public Object clone() {
126: return new DQ(this );
127: }
128:
129: private transient org.cougaar.planning.ldm.dq.DataQuality _dq = null;
130:
131: public boolean hasDataQuality() {
132: return (_dq != null);
133: }
134:
135: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
136: return _dq;
137: }
138:
139: public void setDataQuality(
140: org.cougaar.planning.ldm.dq.DataQuality dq) {
141: _dq = dq;
142: }
143:
144: private void writeObject(ObjectOutputStream out)
145: throws IOException {
146: out.defaultWriteObject();
147: if (out instanceof org.cougaar.core.persist.PersistenceOutputStream)
148: out.writeObject(_dq);
149: }
150:
151: private void readObject(ObjectInputStream in)
152: throws ClassNotFoundException, IOException {
153: in.defaultReadObject();
154: if (in instanceof org.cougaar.core.persist.PersistenceInputStream)
155: _dq = (org.cougaar.planning.ldm.dq.DataQuality) in
156: .readObject();
157: }
158:
159: private final static PropertyDescriptor properties[] = new PropertyDescriptor[1];
160: static {
161: try {
162: properties[0] = new PropertyDescriptor("dataQuality",
163: DQ.class, "getDataQuality", null);
164: } catch (Exception e) {
165: e.printStackTrace();
166: }
167: }
168:
169: public PropertyDescriptor[] getPropertyDescriptors() {
170: PropertyDescriptor[] pds = super .properties;
171: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length
172: + properties.length];
173: System.arraycopy(pds, 0, ps, 0, pds.length);
174: System.arraycopy(properties, 0, ps, pds.length,
175: properties.length);
176: return ps;
177: }
178: }
179:
180: private transient CostPG _locked = null;
181:
182: public PropertyGroup lock(Object key) {
183: if (_locked == null)
184: _locked = new _Locked(key);
185: return _locked;
186: }
187:
188: public PropertyGroup lock() {
189: return lock(null);
190: }
191:
192: public NewPropertyGroup unlock(Object key) {
193: return this ;
194: }
195:
196: public Object clone() throws CloneNotSupportedException {
197: return new CostPGImpl(CostPGImpl.this );
198: }
199:
200: public PropertyGroup copy() {
201: try {
202: return (PropertyGroup) clone();
203: } catch (CloneNotSupportedException cnse) {
204: return null;
205: }
206: }
207:
208: public Class getPrimaryClass() {
209: return primaryClass;
210: }
211:
212: public String getAssetGetMethod() {
213: return assetGetter;
214: }
215:
216: public String getAssetSetMethod() {
217: return assetSetter;
218: }
219:
220: private final static PropertyDescriptor properties[] = new PropertyDescriptor[2];
221: static {
222: try {
223: properties[0] = new PropertyDescriptor("per_diem_cost",
224: CostPG.class, "getPerDiemCost", null);
225: properties[1] = new PropertyDescriptor("break_out_cost",
226: CostPG.class, "getBreakOutCost", null);
227: } catch (Exception e) {
228: org.cougaar.util.log.Logging.getLogger(CostPG.class).error(
229: "Caught exception", e);
230: }
231: }
232:
233: public PropertyDescriptor[] getPropertyDescriptors() {
234: return properties;
235: }
236:
237: private final class _Locked extends java.beans.SimpleBeanInfo
238: implements CostPG, Cloneable, LockedPG {
239: private transient Object theKey = null;
240:
241: _Locked(Object key) {
242: if (this .theKey == null)
243: this .theKey = key;
244: }
245:
246: public _Locked() {
247: }
248:
249: public PropertyGroup lock() {
250: return this ;
251: }
252:
253: public PropertyGroup lock(Object o) {
254: return this ;
255: }
256:
257: public NewPropertyGroup unlock(Object key)
258: throws IllegalAccessException {
259: if (theKey.equals(key)) {
260: return CostPGImpl.this ;
261: } else {
262: throw new IllegalAccessException(
263: "unlock: mismatched internal and provided keys!");
264: }
265: }
266:
267: public PropertyGroup copy() {
268: try {
269: return (PropertyGroup) clone();
270: } catch (CloneNotSupportedException cnse) {
271: return null;
272: }
273: }
274:
275: public Object clone() throws CloneNotSupportedException {
276: return new CostPGImpl(CostPGImpl.this );
277: }
278:
279: public boolean equals(Object object) {
280: return CostPGImpl.this .equals(object);
281: }
282:
283: public CostRate getPerDiemCost() {
284: return CostPGImpl.this .getPerDiemCost();
285: }
286:
287: public double getBreakOutCost() {
288: return CostPGImpl.this .getBreakOutCost();
289: }
290:
291: public final boolean hasDataQuality() {
292: return CostPGImpl.this .hasDataQuality();
293: }
294:
295: public final org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
296: return CostPGImpl.this .getDataQuality();
297: }
298:
299: public Class getPrimaryClass() {
300: return primaryClass;
301: }
302:
303: public String getAssetGetMethod() {
304: return assetGetter;
305: }
306:
307: public String getAssetSetMethod() {
308: return assetSetter;
309: }
310:
311: public PropertyDescriptor[] getPropertyDescriptors() {
312: return properties;
313: }
314:
315: public Class getIntrospectionClass() {
316: return CostPGImpl.class;
317: }
318:
319: }
320:
321: }
|