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 CSSCapabilityPG.
029: * @see CSSCapabilityPG
030: * @see NewCSSCapabilityPG
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 CSSCapabilityPGImpl extends java.beans.SimpleBeanInfo
051: implements NewCSSCapabilityPG, Cloneable {
052: public CSSCapabilityPGImpl() {
053: }
054:
055: // Slots
056:
057: private Collection theCapabilities;
058:
059: public Collection getCapabilities() {
060: return theCapabilities;
061: }
062:
063: public boolean inCapabilities(CSSCapability _element) {
064: return (theCapabilities == null) ? false : (theCapabilities
065: .contains(_element));
066: }
067:
068: public CSSCapability[] getCapabilitiesAsArray() {
069: if (theCapabilities == null)
070: return new CSSCapability[0];
071: int l = theCapabilities.size();
072: CSSCapability[] v = new CSSCapability[l];
073: int i = 0;
074: for (Iterator n = theCapabilities.iterator(); n.hasNext();) {
075: v[i] = (CSSCapability) n.next();
076: i++;
077: }
078: return v;
079: }
080:
081: public CSSCapability getIndexedCapabilities(int _index) {
082: if (theCapabilities == null)
083: return null;
084: for (Iterator _i = theCapabilities.iterator(); _i.hasNext();) {
085: CSSCapability _e = (CSSCapability) _i.next();
086: if (_index == 0)
087: return _e;
088: _index--;
089: }
090: return null;
091: }
092:
093: public void setCapabilities(Collection capabilities) {
094: theCapabilities = capabilities;
095: }
096:
097: public void clearCapabilities() {
098: theCapabilities.clear();
099: }
100:
101: public boolean removeFromCapabilities(CSSCapability _element) {
102: return theCapabilities.remove(_element);
103: }
104:
105: public boolean addToCapabilities(CSSCapability _element) {
106: return theCapabilities.add(_element);
107: }
108:
109: public CSSCapabilityPGImpl(CSSCapabilityPG original) {
110: theCapabilities = original.getCapabilities();
111: }
112:
113: public boolean equals(Object other) {
114:
115: if (!(other instanceof CSSCapabilityPG)) {
116: return false;
117: }
118:
119: CSSCapabilityPG otherCSSCapabilityPG = (CSSCapabilityPG) other;
120:
121: if (getCapabilities() == null) {
122: if (otherCSSCapabilityPG.getCapabilities() != null) {
123: return false;
124: }
125: } else if (!(getCapabilities().equals(otherCSSCapabilityPG
126: .getCapabilities()))) {
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 CSSCapabilityPGImpl implements
143: org.cougaar.planning.ldm.dq.NewHasDataQuality {
144: public DQ() {
145: super ();
146: }
147:
148: public DQ(CSSCapabilityPG 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 CSSCapabilityPG _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 CSSCapabilityPGImpl(CSSCapabilityPGImpl.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[1];
248: static {
249: try {
250: properties[0] = new IndexedPropertyDescriptor(
251: "capabilities", CSSCapabilityPG.class,
252: "getCapabilitiesAsArray", null,
253: "getIndexedCapabilities", null);
254: } catch (Exception e) {
255: org.cougaar.util.log.Logging.getLogger(
256: CSSCapabilityPG.class).error("Caught exception", e);
257: }
258: }
259:
260: public PropertyDescriptor[] getPropertyDescriptors() {
261: return properties;
262: }
263:
264: private final class _Locked extends java.beans.SimpleBeanInfo
265: implements CSSCapabilityPG, Cloneable, LockedPG {
266: private transient Object theKey = null;
267:
268: _Locked(Object key) {
269: if (this .theKey == null)
270: this .theKey = key;
271: }
272:
273: public _Locked() {
274: }
275:
276: public PropertyGroup lock() {
277: return this ;
278: }
279:
280: public PropertyGroup lock(Object o) {
281: return this ;
282: }
283:
284: public NewPropertyGroup unlock(Object key)
285: throws IllegalAccessException {
286: if (theKey.equals(key)) {
287: return CSSCapabilityPGImpl.this ;
288: } else {
289: throw new IllegalAccessException(
290: "unlock: mismatched internal and provided keys!");
291: }
292: }
293:
294: public PropertyGroup copy() {
295: try {
296: return (PropertyGroup) clone();
297: } catch (CloneNotSupportedException cnse) {
298: return null;
299: }
300: }
301:
302: public Object clone() throws CloneNotSupportedException {
303: return new CSSCapabilityPGImpl(CSSCapabilityPGImpl.this );
304: }
305:
306: public boolean equals(Object object) {
307: return CSSCapabilityPGImpl.this .equals(object);
308: }
309:
310: public Collection getCapabilities() {
311: return CSSCapabilityPGImpl.this .getCapabilities();
312: }
313:
314: public boolean inCapabilities(CSSCapability _element) {
315: return CSSCapabilityPGImpl.this .inCapabilities(_element);
316: }
317:
318: public CSSCapability[] getCapabilitiesAsArray() {
319: return CSSCapabilityPGImpl.this .getCapabilitiesAsArray();
320: }
321:
322: public CSSCapability getIndexedCapabilities(int _index) {
323: return CSSCapabilityPGImpl.this
324: .getIndexedCapabilities(_index);
325: }
326:
327: public final boolean hasDataQuality() {
328: return CSSCapabilityPGImpl.this .hasDataQuality();
329: }
330:
331: public final org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
332: return CSSCapabilityPGImpl.this .getDataQuality();
333: }
334:
335: public Class getPrimaryClass() {
336: return primaryClass;
337: }
338:
339: public String getAssetGetMethod() {
340: return assetGetter;
341: }
342:
343: public String getAssetSetMethod() {
344: return assetSetter;
345: }
346:
347: public PropertyDescriptor[] getPropertyDescriptors() {
348: return properties;
349: }
350:
351: public Class getIntrospectionClass() {
352: return CSSCapabilityPGImpl.class;
353: }
354:
355: }
356:
357: }
|