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:49 EDT 2007 from /u01/builds/cougaar/B12_4/B12_4/070927151721/src/glm/src/org/cougaar/lib/quo/performance/assets/programmer_assets.def - DO NOT HAND EDIT */
028: package org.cougaar.lib.quo.performance.assets;
029:
030: import org.cougaar.planning.ldm.asset.*;
031: import java.io.ObjectOutputStream;
032: import java.io.ObjectInputStream;
033: import java.io.IOException;
034: import java.util.Vector;
035: import java.beans.PropertyDescriptor;
036: import java.beans.IndexedPropertyDescriptor;
037: import java.beans.IntrospectionException;
038:
039: /** Representation of a programmer with languages and skills represented **/
040:
041: public class ProgrammerAsset extends
042: org.cougaar.lib.quo.performance.ProgrammerAssetAdapter {
043:
044: public ProgrammerAsset() {
045: myLanguagePG = null;
046: mySkillsPG = null;
047: }
048:
049: public ProgrammerAsset(ProgrammerAsset prototype) {
050: super (prototype);
051: myLanguagePG = null;
052: mySkillsPG = null;
053: }
054:
055: /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/
056: public Object clone() throws CloneNotSupportedException {
057: ProgrammerAsset _thing = (ProgrammerAsset) super .clone();
058: if (myLanguagePG != null)
059: _thing.setLanguagePG(myLanguagePG.lock());
060: if (mySkillsPG != null)
061: _thing.setSkillsPG(mySkillsPG.lock());
062: return _thing;
063: }
064:
065: /** create an instance of the right class for copy operations **/
066: public Asset instanceForCopy() {
067: return new ProgrammerAsset();
068: }
069:
070: /** create an instance of this prototype **/
071: public Asset createInstance() {
072: return new ProgrammerAsset(this );
073: }
074:
075: protected void fillAllPropertyGroups(Vector v) {
076: super .fillAllPropertyGroups(v);
077: {
078: Object _tmp = getLanguagePG();
079: if (_tmp != null && !(_tmp instanceof Null_PG)) {
080: v.addElement(_tmp);
081: }
082: }
083: {
084: Object _tmp = getSkillsPG();
085: if (_tmp != null && !(_tmp instanceof Null_PG)) {
086: v.addElement(_tmp);
087: }
088: }
089: }
090:
091: private transient LanguagePG myLanguagePG;
092:
093: public LanguagePG getLanguagePG() {
094: LanguagePG _tmp = (myLanguagePG != null) ? myLanguagePG
095: : (LanguagePG) resolvePG(LanguagePG.class);
096: return (_tmp == LanguagePG.nullPG) ? null : _tmp;
097: }
098:
099: public void setLanguagePG(PropertyGroup arg_LanguagePG) {
100: if (!(arg_LanguagePG instanceof LanguagePG))
101: throw new IllegalArgumentException(
102: "setLanguagePG requires a LanguagePG argument.");
103: myLanguagePG = (LanguagePG) arg_LanguagePG;
104: }
105:
106: private transient SkillsPG mySkillsPG;
107:
108: public SkillsPG getSkillsPG() {
109: SkillsPG _tmp = (mySkillsPG != null) ? mySkillsPG
110: : (SkillsPG) resolvePG(SkillsPG.class);
111: return (_tmp == SkillsPG.nullPG) ? null : _tmp;
112: }
113:
114: public void setSkillsPG(PropertyGroup arg_SkillsPG) {
115: if (!(arg_SkillsPG instanceof SkillsPG))
116: throw new IllegalArgumentException(
117: "setSkillsPG requires a SkillsPG argument.");
118: mySkillsPG = (SkillsPG) arg_SkillsPG;
119: }
120:
121: // generic search methods
122: public PropertyGroup getLocalPG(Class c, long t) {
123: if (LanguagePG.class.equals(c)) {
124: return (myLanguagePG == LanguagePG.nullPG) ? null
125: : myLanguagePG;
126: }
127: if (SkillsPG.class.equals(c)) {
128: return (mySkillsPG == SkillsPG.nullPG) ? null : mySkillsPG;
129: }
130: return super .getLocalPG(c, t);
131: }
132:
133: public PropertyGroupSchedule getLocalPGSchedule(Class c) {
134: return super .getLocalPGSchedule(c);
135: }
136:
137: public void setLocalPG(Class c, PropertyGroup pg) {
138: if (LanguagePG.class.equals(c)) {
139: myLanguagePG = (LanguagePG) pg;
140: } else if (SkillsPG.class.equals(c)) {
141: mySkillsPG = (SkillsPG) pg;
142: } else
143: super .setLocalPG(c, pg);
144: }
145:
146: public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) {
147: super .setLocalPGSchedule(pgSchedule);
148: }
149:
150: public PropertyGroup removeLocalPG(Class c) {
151: PropertyGroup removed = null;
152: if (LanguagePG.class.equals(c)) {
153: removed = myLanguagePG;
154: myLanguagePG = null;
155: } else if (SkillsPG.class.equals(c)) {
156: removed = mySkillsPG;
157: mySkillsPG = null;
158: } else {
159: removed = super .removeLocalPG(c);
160: }
161: return removed;
162: }
163:
164: public PropertyGroup removeLocalPG(PropertyGroup pg) {
165: Class pgc = pg.getPrimaryClass();
166: if (LanguagePG.class.equals(pgc)) {
167: PropertyGroup removed = myLanguagePG;
168: myLanguagePG = null;
169: return removed;
170: } else if (SkillsPG.class.equals(pgc)) {
171: PropertyGroup removed = mySkillsPG;
172: mySkillsPG = null;
173: return removed;
174: } else {
175: }
176: return super .removeLocalPG(pg);
177: }
178:
179: public PropertyGroupSchedule removeLocalPGSchedule(Class c) {
180: {
181: return super .removeLocalPGSchedule(c);
182: }
183: }
184:
185: public PropertyGroup generateDefaultPG(Class c) {
186: if (LanguagePG.class.equals(c)) {
187: return (myLanguagePG = new LanguagePGImpl());
188: } else if (SkillsPG.class.equals(c)) {
189: return (mySkillsPG = new SkillsPGImpl());
190: } else
191: return super .generateDefaultPG(c);
192: }
193:
194: // dumb serialization methods
195:
196: private void writeObject(ObjectOutputStream out) throws IOException {
197: out.defaultWriteObject();
198: if (myLanguagePG instanceof Null_PG
199: || myLanguagePG instanceof Future_PG) {
200: out.writeObject(null);
201: } else {
202: out.writeObject(myLanguagePG);
203: }
204: if (mySkillsPG instanceof Null_PG
205: || mySkillsPG instanceof Future_PG) {
206: out.writeObject(null);
207: } else {
208: out.writeObject(mySkillsPG);
209: }
210: }
211:
212: private void readObject(ObjectInputStream in)
213: throws ClassNotFoundException, IOException {
214: in.defaultReadObject();
215: myLanguagePG = (LanguagePG) in.readObject();
216: mySkillsPG = (SkillsPG) in.readObject();
217: }
218:
219: // beaninfo support
220: private static PropertyDescriptor properties[];
221: static {
222: try {
223: properties = new PropertyDescriptor[2];
224: properties[0] = new PropertyDescriptor("LanguagePG",
225: ProgrammerAsset.class, "getLanguagePG", null);
226: properties[1] = new PropertyDescriptor("SkillsPG",
227: ProgrammerAsset.class, "getSkillsPG", null);
228: } catch (IntrospectionException ie) {
229: }
230: }
231:
232: public PropertyDescriptor[] getPropertyDescriptors() {
233: PropertyDescriptor[] pds = super .getPropertyDescriptors();
234: PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + 2];
235: System.arraycopy(pds, 0, ps, 0, pds.length);
236: System.arraycopy(properties, 0, ps, pds.length, 2);
237: return ps;
238: }
239: }
|