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 ContentsPG.
029: * @see ContentsPG
030: * @see NewContentsPG
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 ContentsPGImpl extends java.beans.SimpleBeanInfo implements
051: NewContentsPG, Cloneable {
052: public ContentsPGImpl() {
053: }
054:
055: // Slots
056:
057: private Collection theTypeIdentifications;
058:
059: public Collection getTypeIdentifications() {
060: return theTypeIdentifications;
061: }
062:
063: public boolean inTypeIdentifications(String _element) {
064: return (theTypeIdentifications == null) ? false
065: : (theTypeIdentifications.contains(_element));
066: }
067:
068: public String[] getTypeIdentificationsAsArray() {
069: if (theTypeIdentifications == null)
070: return new String[0];
071: int l = theTypeIdentifications.size();
072: String[] v = new String[l];
073: int i = 0;
074: for (Iterator n = theTypeIdentifications.iterator(); n
075: .hasNext();) {
076: v[i] = (String) n.next();
077: i++;
078: }
079: return v;
080: }
081:
082: public String getIndexedTypeIdentifications(int _index) {
083: if (theTypeIdentifications == null)
084: return null;
085: for (Iterator _i = theTypeIdentifications.iterator(); _i
086: .hasNext();) {
087: String _e = (String) _i.next();
088: if (_index == 0)
089: return _e;
090: _index--;
091: }
092: return null;
093: }
094:
095: public void setTypeIdentifications(Collection type_identifications) {
096: theTypeIdentifications = type_identifications;
097: }
098:
099: public void clearTypeIdentifications() {
100: theTypeIdentifications.clear();
101: }
102:
103: public boolean removeFromTypeIdentifications(String _element) {
104: return theTypeIdentifications.remove(_element);
105: }
106:
107: public boolean addToTypeIdentifications(String _element) {
108: return theTypeIdentifications.add(_element);
109: }
110:
111: private Collection theNomenclatures;
112:
113: public Collection getNomenclatures() {
114: return theNomenclatures;
115: }
116:
117: public boolean inNomenclatures(String _element) {
118: return (theNomenclatures == null) ? false : (theNomenclatures
119: .contains(_element));
120: }
121:
122: public String[] getNomenclaturesAsArray() {
123: if (theNomenclatures == null)
124: return new String[0];
125: int l = theNomenclatures.size();
126: String[] v = new String[l];
127: int i = 0;
128: for (Iterator n = theNomenclatures.iterator(); n.hasNext();) {
129: v[i] = (String) n.next();
130: i++;
131: }
132: return v;
133: }
134:
135: public String getIndexedNomenclatures(int _index) {
136: if (theNomenclatures == null)
137: return null;
138: for (Iterator _i = theNomenclatures.iterator(); _i.hasNext();) {
139: String _e = (String) _i.next();
140: if (_index == 0)
141: return _e;
142: _index--;
143: }
144: return null;
145: }
146:
147: public void setNomenclatures(Collection nomenclatures) {
148: theNomenclatures = nomenclatures;
149: }
150:
151: public void clearNomenclatures() {
152: theNomenclatures.clear();
153: }
154:
155: public boolean removeFromNomenclatures(String _element) {
156: return theNomenclatures.remove(_element);
157: }
158:
159: public boolean addToNomenclatures(String _element) {
160: return theNomenclatures.add(_element);
161: }
162:
163: private Collection theWeights;
164:
165: public Collection getWeights() {
166: return theWeights;
167: }
168:
169: public boolean inWeights(Mass _element) {
170: return (theWeights == null) ? false : (theWeights
171: .contains(_element));
172: }
173:
174: public Mass[] getWeightsAsArray() {
175: if (theWeights == null)
176: return new Mass[0];
177: int l = theWeights.size();
178: Mass[] v = new Mass[l];
179: int i = 0;
180: for (Iterator n = theWeights.iterator(); n.hasNext();) {
181: v[i] = (Mass) n.next();
182: i++;
183: }
184: return v;
185: }
186:
187: public Mass getIndexedWeights(int _index) {
188: if (theWeights == null)
189: return null;
190: for (Iterator _i = theWeights.iterator(); _i.hasNext();) {
191: Mass _e = (Mass) _i.next();
192: if (_index == 0)
193: return _e;
194: _index--;
195: }
196: return null;
197: }
198:
199: public void setWeights(Collection weights) {
200: theWeights = weights;
201: }
202:
203: public void clearWeights() {
204: theWeights.clear();
205: }
206:
207: public boolean removeFromWeights(Mass _element) {
208: return theWeights.remove(_element);
209: }
210:
211: public boolean addToWeights(Mass _element) {
212: return theWeights.add(_element);
213: }
214:
215: private Collection theReceivers;
216:
217: public Collection getReceivers() {
218: return theReceivers;
219: }
220:
221: public boolean inReceivers(String _element) {
222: return (theReceivers == null) ? false : (theReceivers
223: .contains(_element));
224: }
225:
226: public String[] getReceiversAsArray() {
227: if (theReceivers == null)
228: return new String[0];
229: int l = theReceivers.size();
230: String[] v = new String[l];
231: int i = 0;
232: for (Iterator n = theReceivers.iterator(); n.hasNext();) {
233: v[i] = (String) n.next();
234: i++;
235: }
236: return v;
237: }
238:
239: public String getIndexedReceivers(int _index) {
240: if (theReceivers == null)
241: return null;
242: for (Iterator _i = theReceivers.iterator(); _i.hasNext();) {
243: String _e = (String) _i.next();
244: if (_index == 0)
245: return _e;
246: _index--;
247: }
248: return null;
249: }
250:
251: public void setReceivers(Collection receivers) {
252: theReceivers = receivers;
253: }
254:
255: public void clearReceivers() {
256: theReceivers.clear();
257: }
258:
259: public boolean removeFromReceivers(String _element) {
260: return theReceivers.remove(_element);
261: }
262:
263: public boolean addToReceivers(String _element) {
264: return theReceivers.add(_element);
265: }
266:
267: public ContentsPGImpl(ContentsPG original) {
268: theTypeIdentifications = original.getTypeIdentifications();
269: theNomenclatures = original.getNomenclatures();
270: theWeights = original.getWeights();
271: theReceivers = original.getReceivers();
272: }
273:
274: public boolean equals(Object other) {
275:
276: if (!(other instanceof ContentsPG)) {
277: return false;
278: }
279:
280: ContentsPG otherContentsPG = (ContentsPG) other;
281:
282: if (getTypeIdentifications() == null) {
283: if (otherContentsPG.getTypeIdentifications() != null) {
284: return false;
285: }
286: } else if (!(getTypeIdentifications().equals(otherContentsPG
287: .getTypeIdentifications()))) {
288: return false;
289: }
290:
291: if (getNomenclatures() == null) {
292: if (otherContentsPG.getNomenclatures() != null) {
293: return false;
294: }
295: } else if (!(getNomenclatures().equals(otherContentsPG
296: .getNomenclatures()))) {
297: return false;
298: }
299:
300: if (getWeights() == null) {
301: if (otherContentsPG.getWeights() != null) {
302: return false;
303: }
304: } else if (!(getWeights().equals(otherContentsPG.getWeights()))) {
305: return false;
306: }
307:
308: if (getReceivers() == null) {
309: if (otherContentsPG.getReceivers() != null) {
310: return false;
311: }
312: } else if (!(getReceivers().equals(otherContentsPG
313: .getReceivers()))) {
314: return false;
315: }
316:
317: return true;
318: }
319:
320: public boolean hasDataQuality() {
321: return false;
322: }
323:
324: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
325: return null;
326: }
327:
328: // static inner extension class for real DataQuality Support
329: public final static class DQ extends ContentsPGImpl implements
330: org.cougaar.planning.ldm.dq.NewHasDataQuality {
331: public DQ() {
332: super ();
333: }
334:
335: public DQ(ContentsPG original) {
336: super (original);
337: }
338:
339: public Object clone() {
340: return new DQ(this );
341: }
342:
343: private transient org.cougaar.planning.ldm.dq.DataQuality _dq = null;
344:
345: public boolean hasDataQuality() {
346: return (_dq != null);
347: }
348:
349: public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
350: return _dq;
351: }
352:
353: public void setDataQuality(
354: org.cougaar.planning.ldm.dq.DataQuality dq) {
355: _dq = dq;
356: }
357:
358: private void writeObject(ObjectOutputStream out)
359: throws IOException {
360: out.defaultWriteObject();
361: if (out instanceof org.cougaar.core.persist.PersistenceOutputStream)
362: out.writeObject(_dq);
363: }
364:
365: private void readObject(ObjectInputStream in)
366: throws ClassNotFoundException, IOException {
367: in.defaultReadObject();
368: if (in instanceof org.cougaar.core.persist.PersistenceInputStream)
369: _dq = (org.cougaar.planning.ldm.dq.DataQuality) in
370: .readObject();
371: }
372:
373: private final static PropertyDescriptor properties[] = new PropertyDescriptor[1];
374: static {
375: try {
376: properties[0] = new PropertyDescriptor("dataQuality",
377: DQ.class, "getDataQuality", null);
378: } catch (Exception e) {
379: e.printStackTrace();
380: }
381: }
382:
383: public PropertyDescriptor[] getPropertyDescriptors() {
384: PropertyDescriptor[] pds = super .properties;
385: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length
386: + properties.length];
387: System.arraycopy(pds, 0, ps, 0, pds.length);
388: System.arraycopy(properties, 0, ps, pds.length,
389: properties.length);
390: return ps;
391: }
392: }
393:
394: private transient ContentsPG _locked = null;
395:
396: public PropertyGroup lock(Object key) {
397: if (_locked == null)
398: _locked = new _Locked(key);
399: return _locked;
400: }
401:
402: public PropertyGroup lock() {
403: return lock(null);
404: }
405:
406: public NewPropertyGroup unlock(Object key) {
407: return this ;
408: }
409:
410: public Object clone() throws CloneNotSupportedException {
411: return new ContentsPGImpl(ContentsPGImpl.this );
412: }
413:
414: public PropertyGroup copy() {
415: try {
416: return (PropertyGroup) clone();
417: } catch (CloneNotSupportedException cnse) {
418: return null;
419: }
420: }
421:
422: public Class getPrimaryClass() {
423: return primaryClass;
424: }
425:
426: public String getAssetGetMethod() {
427: return assetGetter;
428: }
429:
430: public String getAssetSetMethod() {
431: return assetSetter;
432: }
433:
434: private final static PropertyDescriptor properties[] = new PropertyDescriptor[4];
435: static {
436: try {
437: properties[0] = new IndexedPropertyDescriptor(
438: "type_identifications", ContentsPG.class,
439: "getTypeIdentificationsAsArray", null,
440: "getIndexedTypeIdentifications", null);
441: properties[1] = new IndexedPropertyDescriptor(
442: "nomenclatures", ContentsPG.class,
443: "getNomenclaturesAsArray", null,
444: "getIndexedNomenclatures", null);
445: properties[2] = new IndexedPropertyDescriptor("weights",
446: ContentsPG.class, "getWeightsAsArray", null,
447: "getIndexedWeights", null);
448: properties[3] = new IndexedPropertyDescriptor("receivers",
449: ContentsPG.class, "getReceiversAsArray", null,
450: "getIndexedReceivers", null);
451: } catch (Exception e) {
452: org.cougaar.util.log.Logging.getLogger(ContentsPG.class)
453: .error("Caught exception", e);
454: }
455: }
456:
457: public PropertyDescriptor[] getPropertyDescriptors() {
458: return properties;
459: }
460:
461: private final class _Locked extends java.beans.SimpleBeanInfo
462: implements ContentsPG, Cloneable, LockedPG {
463: private transient Object theKey = null;
464:
465: _Locked(Object key) {
466: if (this .theKey == null)
467: this .theKey = key;
468: }
469:
470: public _Locked() {
471: }
472:
473: public PropertyGroup lock() {
474: return this ;
475: }
476:
477: public PropertyGroup lock(Object o) {
478: return this ;
479: }
480:
481: public NewPropertyGroup unlock(Object key)
482: throws IllegalAccessException {
483: if (theKey.equals(key)) {
484: return ContentsPGImpl.this ;
485: } else {
486: throw new IllegalAccessException(
487: "unlock: mismatched internal and provided keys!");
488: }
489: }
490:
491: public PropertyGroup copy() {
492: try {
493: return (PropertyGroup) clone();
494: } catch (CloneNotSupportedException cnse) {
495: return null;
496: }
497: }
498:
499: public Object clone() throws CloneNotSupportedException {
500: return new ContentsPGImpl(ContentsPGImpl.this );
501: }
502:
503: public boolean equals(Object object) {
504: return ContentsPGImpl.this .equals(object);
505: }
506:
507: public Collection getTypeIdentifications() {
508: return ContentsPGImpl.this .getTypeIdentifications();
509: }
510:
511: public boolean inTypeIdentifications(String _element) {
512: return ContentsPGImpl.this .inTypeIdentifications(_element);
513: }
514:
515: public String[] getTypeIdentificationsAsArray() {
516: return ContentsPGImpl.this .getTypeIdentificationsAsArray();
517: }
518:
519: public String getIndexedTypeIdentifications(int _index) {
520: return ContentsPGImpl.this
521: .getIndexedTypeIdentifications(_index);
522: }
523:
524: public Collection getNomenclatures() {
525: return ContentsPGImpl.this .getNomenclatures();
526: }
527:
528: public boolean inNomenclatures(String _element) {
529: return ContentsPGImpl.this .inNomenclatures(_element);
530: }
531:
532: public String[] getNomenclaturesAsArray() {
533: return ContentsPGImpl.this .getNomenclaturesAsArray();
534: }
535:
536: public String getIndexedNomenclatures(int _index) {
537: return ContentsPGImpl.this .getIndexedNomenclatures(_index);
538: }
539:
540: public Collection getWeights() {
541: return ContentsPGImpl.this .getWeights();
542: }
543:
544: public boolean inWeights(Mass _element) {
545: return ContentsPGImpl.this .inWeights(_element);
546: }
547:
548: public Mass[] getWeightsAsArray() {
549: return ContentsPGImpl.this .getWeightsAsArray();
550: }
551:
552: public Mass getIndexedWeights(int _index) {
553: return ContentsPGImpl.this .getIndexedWeights(_index);
554: }
555:
556: public Collection getReceivers() {
557: return ContentsPGImpl.this .getReceivers();
558: }
559:
560: public boolean inReceivers(String _element) {
561: return ContentsPGImpl.this .inReceivers(_element);
562: }
563:
564: public String[] getReceiversAsArray() {
565: return ContentsPGImpl.this .getReceiversAsArray();
566: }
567:
568: public String getIndexedReceivers(int _index) {
569: return ContentsPGImpl.this .getIndexedReceivers(_index);
570: }
571:
572: public final boolean hasDataQuality() {
573: return ContentsPGImpl.this .hasDataQuality();
574: }
575:
576: public final org.cougaar.planning.ldm.dq.DataQuality getDataQuality() {
577: return ContentsPGImpl.this .getDataQuality();
578: }
579:
580: public Class getPrimaryClass() {
581: return primaryClass;
582: }
583:
584: public String getAssetGetMethod() {
585: return assetGetter;
586: }
587:
588: public String getAssetSetMethod() {
589: return assetSetter;
590: }
591:
592: public PropertyDescriptor[] getPropertyDescriptors() {
593: return properties;
594: }
595:
596: public Class getIntrospectionClass() {
597: return ContentsPGImpl.class;
598: }
599:
600: }
601:
602: }
|