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