schema changes: provenance-entry-date is now an xmlSchema:dateTime bound directly...
[vamsas.git] / src / uk / ac / vamsas / objects / core / DataSetAnnotations.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package uk.ac.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class DataSetAnnotations.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class DataSetAnnotations extends uk.ac.vamsas.objects.core.RangeAnnotation 
23 implements java.io.Serializable
24 {
25
26
27       //--------------------------/
28      //- Class/Member Variables -/
29     //--------------------------/
30
31     /**
32      * annotation is associated with a
33      *  particular dataset sequence 
34      */
35     private java.util.Vector _seqRef;
36
37     /**
38      * Field _provenance.
39      */
40     private uk.ac.vamsas.objects.core.Provenance _provenance;
41
42
43       //----------------/
44      //- Constructors -/
45     //----------------/
46
47     public DataSetAnnotations() {
48         super();
49         this._seqRef = new java.util.Vector();
50     }
51
52
53       //-----------/
54      //- Methods -/
55     //-----------/
56
57     /**
58      * 
59      * 
60      * @param vSeqRef
61      * @throws java.lang.IndexOutOfBoundsException if the index
62      * given is outside the bounds of the collection
63      */
64     public void addSeqRef(
65             final java.lang.Object vSeqRef)
66     throws java.lang.IndexOutOfBoundsException {
67         this._seqRef.addElement(vSeqRef);
68     }
69
70     /**
71      * 
72      * 
73      * @param index
74      * @param vSeqRef
75      * @throws java.lang.IndexOutOfBoundsException if the index
76      * given is outside the bounds of the collection
77      */
78     public void addSeqRef(
79             final int index,
80             final java.lang.Object vSeqRef)
81     throws java.lang.IndexOutOfBoundsException {
82         this._seqRef.add(index, vSeqRef);
83     }
84
85     /**
86      * Method enumerateSeqRef.
87      * 
88      * @return an Enumeration over all java.lang.Object elements
89      */
90     public java.util.Enumeration enumerateSeqRef(
91     ) {
92         return this._seqRef.elements();
93     }
94
95     /**
96      * Overrides the java.lang.Object.equals method.
97      * 
98      * @param obj
99      * @return true if the objects are equal.
100      */
101     public boolean equals(
102             final java.lang.Object obj) {
103         if ( this == obj )
104             return true;
105         
106         if (super.equals(obj)==false)
107             return false;
108         
109         if (obj instanceof DataSetAnnotations) {
110         
111             DataSetAnnotations temp = (DataSetAnnotations)obj;
112             if (this._seqRef != null) {
113                 if (temp._seqRef == null) return false;
114                 else if (!(this._seqRef.equals(temp._seqRef))) 
115                     return false;
116             }
117             else if (temp._seqRef != null)
118                 return false;
119             if (this._provenance != null) {
120                 if (temp._provenance == null) return false;
121                 else if (!(this._provenance.equals(temp._provenance))) 
122                     return false;
123             }
124             else if (temp._provenance != null)
125                 return false;
126             return true;
127         }
128         return false;
129     }
130
131     /**
132      * Returns the value of field 'provenance'.
133      * 
134      * @return the value of field 'Provenance'.
135      */
136     public uk.ac.vamsas.objects.core.Provenance getProvenance(
137     ) {
138         return this._provenance;
139     }
140
141     /**
142      * Method getSeqRef.
143      * 
144      * @param index
145      * @throws java.lang.IndexOutOfBoundsException if the index
146      * given is outside the bounds of the collection
147      * @return the value of the java.lang.Object at the given index
148      */
149     public java.lang.Object getSeqRef(
150             final int index)
151     throws java.lang.IndexOutOfBoundsException {
152         // check bounds for index
153         if (index < 0 || index >= this._seqRef.size()) {
154             throw new IndexOutOfBoundsException("getSeqRef: Index value '" + index + "' not in range [0.." + (this._seqRef.size() - 1) + "]");
155         }
156         
157         return _seqRef.get(index);
158     }
159
160     /**
161      * Method getSeqRef.Returns the contents of the collection in
162      * an Array.  <p>Note:  Just in case the collection contents
163      * are changing in another thread, we pass a 0-length Array of
164      * the correct type into the API call.  This way we <i>know</i>
165      * that the Array returned is of exactly the correct length.
166      * 
167      * @return this collection as an Array
168      */
169     public java.lang.Object[] getSeqRef(
170     ) {
171         java.lang.Object[] array = new java.lang.Object[0];
172         return (java.lang.Object[]) this._seqRef.toArray(array);
173     }
174
175     /**
176      * Method getSeqRefAsReference.Returns a reference to
177      * '_seqRef'. No type checking is performed on any
178      * modifications to the Vector.
179      * 
180      * @return a reference to the Vector backing this class
181      */
182     public java.util.Vector getSeqRefAsReference(
183     ) {
184         return this._seqRef;
185     }
186
187     /**
188      * Method getSeqRefCount.
189      * 
190      * @return the size of this collection
191      */
192     public int getSeqRefCount(
193     ) {
194         return this._seqRef.size();
195     }
196
197     /**
198      * Overrides the java.lang.Object.hashCode method.
199      * <p>
200      * The following steps came from <b>Effective Java Programming
201      * Language Guide</b> by Joshua Bloch, Chapter 3
202      * 
203      * @return a hash code value for the object.
204      */
205     public int hashCode(
206     ) {
207         int result = super.hashCode();
208         
209         long tmp;
210         if (_seqRef != null) {
211            result = 37 * result + _seqRef.hashCode();
212         }
213         if (_provenance != null) {
214            result = 37 * result + _provenance.hashCode();
215         }
216         
217         return result;
218     }
219
220     /**
221      * Method isValid.
222      * 
223      * @return true if this object is valid according to the schema
224      */
225     public boolean isValid(
226     ) {
227         try {
228             validate();
229         } catch (org.exolab.castor.xml.ValidationException vex) {
230             return false;
231         }
232         return true;
233     }
234
235     /**
236      * 
237      * 
238      * @param out
239      * @throws org.exolab.castor.xml.MarshalException if object is
240      * null or if any SAXException is thrown during marshaling
241      * @throws org.exolab.castor.xml.ValidationException if this
242      * object is an invalid instance according to the schema
243      */
244     public void marshal(
245             final java.io.Writer out)
246     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
247         Marshaller.marshal(this, out);
248     }
249
250     /**
251      * 
252      * 
253      * @param handler
254      * @throws java.io.IOException if an IOException occurs during
255      * marshaling
256      * @throws org.exolab.castor.xml.ValidationException if this
257      * object is an invalid instance according to the schema
258      * @throws org.exolab.castor.xml.MarshalException if object is
259      * null or if any SAXException is thrown during marshaling
260      */
261     public void marshal(
262             final org.xml.sax.ContentHandler handler)
263     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
264         Marshaller.marshal(this, handler);
265     }
266
267     /**
268      */
269     public void removeAllSeqRef(
270     ) {
271         this._seqRef.clear();
272     }
273
274     /**
275      * Method removeSeqRef.
276      * 
277      * @param vSeqRef
278      * @return true if the object was removed from the collection.
279      */
280     public boolean removeSeqRef(
281             final java.lang.Object vSeqRef) {
282         boolean removed = _seqRef.remove(vSeqRef);
283         return removed;
284     }
285
286     /**
287      * Method removeSeqRefAt.
288      * 
289      * @param index
290      * @return the element removed from the collection
291      */
292     public java.lang.Object removeSeqRefAt(
293             final int index) {
294         java.lang.Object obj = this._seqRef.remove(index);
295         return obj;
296     }
297
298     /**
299      * Sets the value of field 'provenance'.
300      * 
301      * @param provenance the value of field 'provenance'.
302      */
303     public void setProvenance(
304             final uk.ac.vamsas.objects.core.Provenance provenance) {
305         this._provenance = provenance;
306     }
307
308     /**
309      * 
310      * 
311      * @param index
312      * @param vSeqRef
313      * @throws java.lang.IndexOutOfBoundsException if the index
314      * given is outside the bounds of the collection
315      */
316     public void setSeqRef(
317             final int index,
318             final java.lang.Object vSeqRef)
319     throws java.lang.IndexOutOfBoundsException {
320         // check bounds for index
321         if (index < 0 || index >= this._seqRef.size()) {
322             throw new IndexOutOfBoundsException("setSeqRef: Index value '" + index + "' not in range [0.." + (this._seqRef.size() - 1) + "]");
323         }
324         
325         this._seqRef.set(index, vSeqRef);
326     }
327
328     /**
329      * 
330      * 
331      * @param vSeqRefArray
332      */
333     public void setSeqRef(
334             final java.lang.Object[] vSeqRefArray) {
335         //-- copy array
336         _seqRef.clear();
337         
338         for (int i = 0; i < vSeqRefArray.length; i++) {
339                 this._seqRef.add(vSeqRefArray[i]);
340         }
341     }
342
343     /**
344      * Sets the value of '_seqRef' by copying the given Vector. All
345      * elements will be checked for type safety.
346      * 
347      * @param vSeqRefList the Vector to copy.
348      */
349     public void setSeqRef(
350             final java.util.Vector vSeqRefList) {
351         // copy vector
352         this._seqRef.clear();
353         
354         this._seqRef.addAll(vSeqRefList);
355     }
356
357     /**
358      * Sets the value of '_seqRef' by setting it to the given
359      * Vector. No type checking is performed.
360      * @deprecated
361      * 
362      * @param seqRefVector the Vector to set.
363      */
364     public void setSeqRefAsReference(
365             final java.util.Vector seqRefVector) {
366         this._seqRef = seqRefVector;
367     }
368
369     /**
370      * Method unmarshal.
371      * 
372      * @param reader
373      * @throws org.exolab.castor.xml.MarshalException if object is
374      * null or if any SAXException is thrown during marshaling
375      * @throws org.exolab.castor.xml.ValidationException if this
376      * object is an invalid instance according to the schema
377      * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType
378      */
379     public static uk.ac.vamsas.objects.core.RangeType unmarshal(
380             final java.io.Reader reader)
381     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
382         return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DataSetAnnotations.class, reader);
383     }
384
385     /**
386      * 
387      * 
388      * @throws org.exolab.castor.xml.ValidationException if this
389      * object is an invalid instance according to the schema
390      */
391     public void validate(
392     )
393     throws org.exolab.castor.xml.ValidationException {
394         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
395         validator.validate(this);
396     }
397
398 }