View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: DataCollectionType.java,v 1.14 2007/01/04 16:26:07 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.resource.dataservice;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.IOException;
15  import java.io.Reader;
16  import java.io.Serializable;
17  import java.io.Writer;
18  import java.util.ArrayList;
19  import java.util.Enumeration;
20  import org.astrogrid.registry.beans.resource.ResourceReferenceType;
21  import org.exolab.castor.xml.MarshalException;
22  import org.exolab.castor.xml.Marshaller;
23  import org.exolab.castor.xml.Unmarshaller;
24  import org.exolab.castor.xml.ValidationException;
25  import org.xml.sax.ContentHandler;
26  
27  /***
28   * Class DataCollectionType.
29   * 
30   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:07 $
31   */
32  public class DataCollectionType extends org.astrogrid.registry.beans.resource.ResourceType 
33  implements java.io.Serializable
34  {
35  
36  
37        //--------------------------/
38       //- Class/Member Variables -/
39      //--------------------------/
40  
41      /***
42       * the observatory or facility used to collect the data 
43       *  contained or managed by this resource. 
44       *  
45       */
46      private java.util.ArrayList _facilityList;
47  
48      /***
49       * the Instrument used to collect the data contain or 
50       *  managed by a resource. 
51       *  
52       */
53      private java.util.ArrayList _instrumentList;
54  
55      /***
56       * Extent of the content of the resource over space, time, and 
57       *  frequency.
58       *  
59       */
60      private org.astrogrid.registry.beans.resource.dataservice.CoverageType _coverage;
61  
62      /***
63       * a description about how a data collection may be accessed
64       *  
65       */
66      private org.astrogrid.registry.beans.resource.dataservice.AccessType _access;
67  
68  
69        //----------------/
70       //- Constructors -/
71      //----------------/
72  
73      public DataCollectionType() {
74          super();
75          _facilityList = new ArrayList();
76          _instrumentList = new ArrayList();
77      } //-- org.astrogrid.registry.beans.resource.dataservice.DataCollectionType()
78  
79  
80        //-----------/
81       //- Methods -/
82      //-----------/
83  
84      /***
85       * Method addFacility
86       * 
87       * @param vFacility
88       */
89      public void addFacility(org.astrogrid.registry.beans.resource.ResourceReferenceType vFacility)
90          throws java.lang.IndexOutOfBoundsException
91      {
92          _facilityList.add(vFacility);
93      } //-- void addFacility(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
94  
95      /***
96       * Method addFacility
97       * 
98       * @param index
99       * @param vFacility
100      */
101     public void addFacility(int index, org.astrogrid.registry.beans.resource.ResourceReferenceType vFacility)
102         throws java.lang.IndexOutOfBoundsException
103     {
104         _facilityList.add(index, vFacility);
105     } //-- void addFacility(int, org.astrogrid.registry.beans.resource.ResourceReferenceType) 
106 
107     /***
108      * Method addInstrument
109      * 
110      * @param vInstrument
111      */
112     public void addInstrument(org.astrogrid.registry.beans.resource.ResourceReferenceType vInstrument)
113         throws java.lang.IndexOutOfBoundsException
114     {
115         _instrumentList.add(vInstrument);
116     } //-- void addInstrument(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
117 
118     /***
119      * Method addInstrument
120      * 
121      * @param index
122      * @param vInstrument
123      */
124     public void addInstrument(int index, org.astrogrid.registry.beans.resource.ResourceReferenceType vInstrument)
125         throws java.lang.IndexOutOfBoundsException
126     {
127         _instrumentList.add(index, vInstrument);
128     } //-- void addInstrument(int, org.astrogrid.registry.beans.resource.ResourceReferenceType) 
129 
130     /***
131      * Method clearFacility
132      */
133     public void clearFacility()
134     {
135         _facilityList.clear();
136     } //-- void clearFacility() 
137 
138     /***
139      * Method clearInstrument
140      */
141     public void clearInstrument()
142     {
143         _instrumentList.clear();
144     } //-- void clearInstrument() 
145 
146     /***
147      * Method enumerateFacility
148      */
149     public java.util.Enumeration enumerateFacility()
150     {
151         return new org.exolab.castor.util.IteratorEnumeration(_facilityList.iterator());
152     } //-- java.util.Enumeration enumerateFacility() 
153 
154     /***
155      * Method enumerateInstrument
156      */
157     public java.util.Enumeration enumerateInstrument()
158     {
159         return new org.exolab.castor.util.IteratorEnumeration(_instrumentList.iterator());
160     } //-- java.util.Enumeration enumerateInstrument() 
161 
162     /***
163      * Note: hashCode() has not been overriden
164      * 
165      * @param obj
166      */
167     public boolean equals(java.lang.Object obj)
168     {
169         if ( this == obj )
170             return true;
171         
172         if (super.equals(obj)==false)
173             return false;
174         
175         if (obj instanceof DataCollectionType) {
176         
177             DataCollectionType temp = (DataCollectionType)obj;
178             if (this._facilityList != null) {
179                 if (temp._facilityList == null) return false;
180                 else if (!(this._facilityList.equals(temp._facilityList))) 
181                     return false;
182             }
183             else if (temp._facilityList != null)
184                 return false;
185             if (this._instrumentList != null) {
186                 if (temp._instrumentList == null) return false;
187                 else if (!(this._instrumentList.equals(temp._instrumentList))) 
188                     return false;
189             }
190             else if (temp._instrumentList != null)
191                 return false;
192             if (this._coverage != null) {
193                 if (temp._coverage == null) return false;
194                 else if (!(this._coverage.equals(temp._coverage))) 
195                     return false;
196             }
197             else if (temp._coverage != null)
198                 return false;
199             if (this._access != null) {
200                 if (temp._access == null) return false;
201                 else if (!(this._access.equals(temp._access))) 
202                     return false;
203             }
204             else if (temp._access != null)
205                 return false;
206             return true;
207         }
208         return false;
209     } //-- boolean equals(java.lang.Object) 
210 
211     /***
212      * Returns the value of field 'access'. The field 'access' has
213      * the following description: a description about how a data
214      * collection may be accessed
215      *  
216      * 
217      * @return the value of field 'access'.
218      */
219     public org.astrogrid.registry.beans.resource.dataservice.AccessType getAccess()
220     {
221         return this._access;
222     } //-- org.astrogrid.registry.beans.resource.dataservice.AccessType getAccess() 
223 
224     /***
225      * Returns the value of field 'coverage'. The field 'coverage'
226      * has the following description: Extent of the content of the
227      * resource over space, time, and 
228      *  frequency.
229      *  
230      * 
231      * @return the value of field 'coverage'.
232      */
233     public org.astrogrid.registry.beans.resource.dataservice.CoverageType getCoverage()
234     {
235         return this._coverage;
236     } //-- org.astrogrid.registry.beans.resource.dataservice.CoverageType getCoverage() 
237 
238     /***
239      * Method getFacility
240      * 
241      * @param index
242      */
243     public org.astrogrid.registry.beans.resource.ResourceReferenceType getFacility(int index)
244         throws java.lang.IndexOutOfBoundsException
245     {
246         //-- check bounds for index
247         if ((index < 0) || (index > _facilityList.size())) {
248             throw new IndexOutOfBoundsException();
249         }
250         
251         return (org.astrogrid.registry.beans.resource.ResourceReferenceType) _facilityList.get(index);
252     } //-- org.astrogrid.registry.beans.resource.ResourceReferenceType getFacility(int) 
253 
254     /***
255      * Method getFacility
256      */
257     public org.astrogrid.registry.beans.resource.ResourceReferenceType[] getFacility()
258     {
259         int size = _facilityList.size();
260         org.astrogrid.registry.beans.resource.ResourceReferenceType[] mArray = new org.astrogrid.registry.beans.resource.ResourceReferenceType[size];
261         for (int index = 0; index < size; index++) {
262             mArray[index] = (org.astrogrid.registry.beans.resource.ResourceReferenceType) _facilityList.get(index);
263         }
264         return mArray;
265     } //-- org.astrogrid.registry.beans.resource.ResourceReferenceType[] getFacility() 
266 
267     /***
268      * Method getFacilityCount
269      */
270     public int getFacilityCount()
271     {
272         return _facilityList.size();
273     } //-- int getFacilityCount() 
274 
275     /***
276      * Method getInstrument
277      * 
278      * @param index
279      */
280     public org.astrogrid.registry.beans.resource.ResourceReferenceType getInstrument(int index)
281         throws java.lang.IndexOutOfBoundsException
282     {
283         //-- check bounds for index
284         if ((index < 0) || (index > _instrumentList.size())) {
285             throw new IndexOutOfBoundsException();
286         }
287         
288         return (org.astrogrid.registry.beans.resource.ResourceReferenceType) _instrumentList.get(index);
289     } //-- org.astrogrid.registry.beans.resource.ResourceReferenceType getInstrument(int) 
290 
291     /***
292      * Method getInstrument
293      */
294     public org.astrogrid.registry.beans.resource.ResourceReferenceType[] getInstrument()
295     {
296         int size = _instrumentList.size();
297         org.astrogrid.registry.beans.resource.ResourceReferenceType[] mArray = new org.astrogrid.registry.beans.resource.ResourceReferenceType[size];
298         for (int index = 0; index < size; index++) {
299             mArray[index] = (org.astrogrid.registry.beans.resource.ResourceReferenceType) _instrumentList.get(index);
300         }
301         return mArray;
302     } //-- org.astrogrid.registry.beans.resource.ResourceReferenceType[] getInstrument() 
303 
304     /***
305      * Method getInstrumentCount
306      */
307     public int getInstrumentCount()
308     {
309         return _instrumentList.size();
310     } //-- int getInstrumentCount() 
311 
312     /***
313      * Method isValid
314      */
315     public boolean isValid()
316     {
317         try {
318             validate();
319         }
320         catch (org.exolab.castor.xml.ValidationException vex) {
321             return false;
322         }
323         return true;
324     } //-- boolean isValid() 
325 
326     /***
327      * Method marshal
328      * 
329      * @param out
330      */
331     public void marshal(java.io.Writer out)
332         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
333     {
334         
335         Marshaller.marshal(this, out);
336     } //-- void marshal(java.io.Writer) 
337 
338     /***
339      * Method marshal
340      * 
341      * @param handler
342      */
343     public void marshal(org.xml.sax.ContentHandler handler)
344         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
345     {
346         
347         Marshaller.marshal(this, handler);
348     } //-- void marshal(org.xml.sax.ContentHandler) 
349 
350     /***
351      * Method removeFacility
352      * 
353      * @param vFacility
354      */
355     public boolean removeFacility(org.astrogrid.registry.beans.resource.ResourceReferenceType vFacility)
356     {
357         boolean removed = _facilityList.remove(vFacility);
358         return removed;
359     } //-- boolean removeFacility(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
360 
361     /***
362      * Method removeInstrument
363      * 
364      * @param vInstrument
365      */
366     public boolean removeInstrument(org.astrogrid.registry.beans.resource.ResourceReferenceType vInstrument)
367     {
368         boolean removed = _instrumentList.remove(vInstrument);
369         return removed;
370     } //-- boolean removeInstrument(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
371 
372     /***
373      * Sets the value of field 'access'. The field 'access' has the
374      * following description: a description about how a data
375      * collection may be accessed
376      *  
377      * 
378      * @param access the value of field 'access'.
379      */
380     public void setAccess(org.astrogrid.registry.beans.resource.dataservice.AccessType access)
381     {
382         this._access = access;
383     } //-- void setAccess(org.astrogrid.registry.beans.resource.dataservice.AccessType) 
384 
385     /***
386      * Sets the value of field 'coverage'. The field 'coverage' has
387      * the following description: Extent of the content of the
388      * resource over space, time, and 
389      *  frequency.
390      *  
391      * 
392      * @param coverage the value of field 'coverage'.
393      */
394     public void setCoverage(org.astrogrid.registry.beans.resource.dataservice.CoverageType coverage)
395     {
396         this._coverage = coverage;
397     } //-- void setCoverage(org.astrogrid.registry.beans.resource.dataservice.CoverageType) 
398 
399     /***
400      * Method setFacility
401      * 
402      * @param index
403      * @param vFacility
404      */
405     public void setFacility(int index, org.astrogrid.registry.beans.resource.ResourceReferenceType vFacility)
406         throws java.lang.IndexOutOfBoundsException
407     {
408         //-- check bounds for index
409         if ((index < 0) || (index > _facilityList.size())) {
410             throw new IndexOutOfBoundsException();
411         }
412         _facilityList.set(index, vFacility);
413     } //-- void setFacility(int, org.astrogrid.registry.beans.resource.ResourceReferenceType) 
414 
415     /***
416      * Method setFacility
417      * 
418      * @param facilityArray
419      */
420     public void setFacility(org.astrogrid.registry.beans.resource.ResourceReferenceType[] facilityArray)
421     {
422         //-- copy array
423         _facilityList.clear();
424         for (int i = 0; i < facilityArray.length; i++) {
425             _facilityList.add(facilityArray[i]);
426         }
427     } //-- void setFacility(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
428 
429     /***
430      * Method setInstrument
431      * 
432      * @param index
433      * @param vInstrument
434      */
435     public void setInstrument(int index, org.astrogrid.registry.beans.resource.ResourceReferenceType vInstrument)
436         throws java.lang.IndexOutOfBoundsException
437     {
438         //-- check bounds for index
439         if ((index < 0) || (index > _instrumentList.size())) {
440             throw new IndexOutOfBoundsException();
441         }
442         _instrumentList.set(index, vInstrument);
443     } //-- void setInstrument(int, org.astrogrid.registry.beans.resource.ResourceReferenceType) 
444 
445     /***
446      * Method setInstrument
447      * 
448      * @param instrumentArray
449      */
450     public void setInstrument(org.astrogrid.registry.beans.resource.ResourceReferenceType[] instrumentArray)
451     {
452         //-- copy array
453         _instrumentList.clear();
454         for (int i = 0; i < instrumentArray.length; i++) {
455             _instrumentList.add(instrumentArray[i]);
456         }
457     } //-- void setInstrument(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
458 
459     /***
460      * Method unmarshalDataCollectionType
461      * 
462      * @param reader
463      */
464     public static org.astrogrid.registry.beans.resource.dataservice.DataCollectionType unmarshalDataCollectionType(java.io.Reader reader)
465         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
466     {
467         return (org.astrogrid.registry.beans.resource.dataservice.DataCollectionType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.dataservice.DataCollectionType.class, reader);
468     } //-- org.astrogrid.registry.beans.resource.dataservice.DataCollectionType unmarshalDataCollectionType(java.io.Reader) 
469 
470     /***
471      * Method validate
472      */
473     public void validate()
474         throws org.exolab.castor.xml.ValidationException
475     {
476         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
477         validator.validate(this);
478     } //-- void validate() 
479 
480 }