rebult for castor-1.1(vamsas version)
[vamsas.git] / src / uk / ac / vamsas / objects / core / VAMSAS.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  * contains unassociated trees and a number of analysis sets
19  *  
20  * 
21  * @version $Revision$ $Date$
22  */
23 public class VAMSAS extends uk.ac.vamsas.client.Vobject 
24 implements java.io.Serializable
25 {
26
27
28       //--------------------------/
29      //- Class/Member Variables -/
30     //--------------------------/
31
32     /**
33      * Primary Key for vamsas object referencing 
34      */
35     private java.lang.String _id;
36
37     /**
38      * Field _modifiable.
39      */
40     private java.lang.String _modifiable;
41
42     /**
43      * Field _treeList.
44      */
45     private java.util.Vector _treeList;
46
47     /**
48      * Field _dataSetList.
49      */
50     private java.util.Vector _dataSetList;
51
52
53       //----------------/
54      //- Constructors -/
55     //----------------/
56
57     public VAMSAS() {
58         super();
59         this._treeList = new java.util.Vector();
60         this._dataSetList = new java.util.Vector();
61     }
62
63
64       //-----------/
65      //- Methods -/
66     //-----------/
67
68     /**
69      * 
70      * 
71      * @param vDataSet
72      * @throws java.lang.IndexOutOfBoundsException if the index
73      * given is outside the bounds of the collection
74      */
75     public void addDataSet(
76             final uk.ac.vamsas.objects.core.DataSet vDataSet)
77     throws java.lang.IndexOutOfBoundsException {
78         this._dataSetList.addElement(vDataSet);
79     }
80
81     /**
82      * 
83      * 
84      * @param index
85      * @param vDataSet
86      * @throws java.lang.IndexOutOfBoundsException if the index
87      * given is outside the bounds of the collection
88      */
89     public void addDataSet(
90             final int index,
91             final uk.ac.vamsas.objects.core.DataSet vDataSet)
92     throws java.lang.IndexOutOfBoundsException {
93         this._dataSetList.add(index, vDataSet);
94     }
95
96     /**
97      * 
98      * 
99      * @param vTree
100      * @throws java.lang.IndexOutOfBoundsException if the index
101      * given is outside the bounds of the collection
102      */
103     public void addTree(
104             final uk.ac.vamsas.objects.core.Tree vTree)
105     throws java.lang.IndexOutOfBoundsException {
106         this._treeList.addElement(vTree);
107     }
108
109     /**
110      * 
111      * 
112      * @param index
113      * @param vTree
114      * @throws java.lang.IndexOutOfBoundsException if the index
115      * given is outside the bounds of the collection
116      */
117     public void addTree(
118             final int index,
119             final uk.ac.vamsas.objects.core.Tree vTree)
120     throws java.lang.IndexOutOfBoundsException {
121         this._treeList.add(index, vTree);
122     }
123
124     /**
125      * Method enumerateDataSet.
126      * 
127      * @return an Enumeration over all
128      * uk.ac.vamsas.objects.core.DataSet elements
129      */
130     public java.util.Enumeration enumerateDataSet(
131     ) {
132         return this._dataSetList.elements();
133     }
134
135     /**
136      * Method enumerateTree.
137      * 
138      * @return an Enumeration over all
139      * uk.ac.vamsas.objects.core.Tree elements
140      */
141     public java.util.Enumeration enumerateTree(
142     ) {
143         return this._treeList.elements();
144     }
145
146     /**
147      * Overrides the java.lang.Object.equals method.
148      * 
149      * @param obj
150      * @return true if the objects are equal.
151      */
152     public boolean equals(
153             final java.lang.Object obj) {
154         if ( this == obj )
155             return true;
156         
157         if (super.equals(obj)==false)
158             return false;
159         
160         if (obj instanceof VAMSAS) {
161         
162             VAMSAS temp = (VAMSAS)obj;
163             if (this._id != null) {
164                 if (temp._id == null) return false;
165                 else if (!(this._id.equals(temp._id))) 
166                     return false;
167             }
168             else if (temp._id != null)
169                 return false;
170             if (this._modifiable != null) {
171                 if (temp._modifiable == null) return false;
172                 else if (!(this._modifiable.equals(temp._modifiable))) 
173                     return false;
174             }
175             else if (temp._modifiable != null)
176                 return false;
177             if (this._treeList != null) {
178                 if (temp._treeList == null) return false;
179                 else if (!(this._treeList.equals(temp._treeList))) 
180                     return false;
181             }
182             else if (temp._treeList != null)
183                 return false;
184             if (this._dataSetList != null) {
185                 if (temp._dataSetList == null) return false;
186                 else if (!(this._dataSetList.equals(temp._dataSetList))) 
187                     return false;
188             }
189             else if (temp._dataSetList != null)
190                 return false;
191             return true;
192         }
193         return false;
194     }
195
196     /**
197      * Method getDataSet.
198      * 
199      * @param index
200      * @throws java.lang.IndexOutOfBoundsException if the index
201      * given is outside the bounds of the collection
202      * @return the value of the uk.ac.vamsas.objects.core.DataSet
203      * at the given index
204      */
205     public uk.ac.vamsas.objects.core.DataSet getDataSet(
206             final int index)
207     throws java.lang.IndexOutOfBoundsException {
208         // check bounds for index
209         if (index < 0 || index >= this._dataSetList.size()) {
210             throw new IndexOutOfBoundsException("getDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
211         }
212         
213         return (uk.ac.vamsas.objects.core.DataSet) _dataSetList.get(index);
214     }
215
216     /**
217      * Method getDataSet.Returns the contents of the collection in
218      * an Array.  <p>Note:  Just in case the collection contents
219      * are changing in another thread, we pass a 0-length Array of
220      * the correct type into the API call.  This way we <i>know</i>
221      * that the Array returned is of exactly the correct length.
222      * 
223      * @return this collection as an Array
224      */
225     public uk.ac.vamsas.objects.core.DataSet[] getDataSet(
226     ) {
227         uk.ac.vamsas.objects.core.DataSet[] array = new uk.ac.vamsas.objects.core.DataSet[0];
228         return (uk.ac.vamsas.objects.core.DataSet[]) this._dataSetList.toArray(array);
229     }
230
231     /**
232      * Method getDataSetAsReference.Returns a reference to
233      * '_dataSetList'. No type checking is performed on any
234      * modifications to the Vector.
235      * 
236      * @return a reference to the Vector backing this class
237      */
238     public java.util.Vector getDataSetAsReference(
239     ) {
240         return this._dataSetList;
241     }
242
243     /**
244      * Method getDataSetCount.
245      * 
246      * @return the size of this collection
247      */
248     public int getDataSetCount(
249     ) {
250         return this._dataSetList.size();
251     }
252
253     /**
254      * Returns the value of field 'id'. The field 'id' has the
255      * following description: Primary Key for vamsas object
256      * referencing 
257      * 
258      * @return the value of field 'Id'.
259      */
260     public java.lang.String getId(
261     ) {
262         return this._id;
263     }
264
265     /**
266      * Returns the value of field 'modifiable'.
267      * 
268      * @return the value of field 'Modifiable'.
269      */
270     public java.lang.String getModifiable(
271     ) {
272         return this._modifiable;
273     }
274
275     /**
276      * Method getTree.
277      * 
278      * @param index
279      * @throws java.lang.IndexOutOfBoundsException if the index
280      * given is outside the bounds of the collection
281      * @return the value of the uk.ac.vamsas.objects.core.Tree at
282      * the given index
283      */
284     public uk.ac.vamsas.objects.core.Tree getTree(
285             final int index)
286     throws java.lang.IndexOutOfBoundsException {
287         // check bounds for index
288         if (index < 0 || index >= this._treeList.size()) {
289             throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
290         }
291         
292         return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
293     }
294
295     /**
296      * Method getTree.Returns the contents of the collection in an
297      * Array.  <p>Note:  Just in case the collection contents are
298      * changing in another thread, we pass a 0-length Array of the
299      * correct type into the API call.  This way we <i>know</i>
300      * that the Array returned is of exactly the correct length.
301      * 
302      * @return this collection as an Array
303      */
304     public uk.ac.vamsas.objects.core.Tree[] getTree(
305     ) {
306         uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
307         return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
308     }
309
310     /**
311      * Method getTreeAsReference.Returns a reference to
312      * '_treeList'. No type checking is performed on any
313      * modifications to the Vector.
314      * 
315      * @return a reference to the Vector backing this class
316      */
317     public java.util.Vector getTreeAsReference(
318     ) {
319         return this._treeList;
320     }
321
322     /**
323      * Method getTreeCount.
324      * 
325      * @return the size of this collection
326      */
327     public int getTreeCount(
328     ) {
329         return this._treeList.size();
330     }
331
332     /**
333      * Overrides the java.lang.Object.hashCode method.
334      * <p>
335      * The following steps came from <b>Effective Java Programming
336      * Language Guide</b> by Joshua Bloch, Chapter 3
337      * 
338      * @return a hash code value for the object.
339      */
340     public int hashCode(
341     ) {
342         int result = super.hashCode();
343         
344         long tmp;
345         if (_id != null) {
346            result = 37 * result + _id.hashCode();
347         }
348         if (_modifiable != null) {
349            result = 37 * result + _modifiable.hashCode();
350         }
351         if (_treeList != null) {
352            result = 37 * result + _treeList.hashCode();
353         }
354         if (_dataSetList != null) {
355            result = 37 * result + _dataSetList.hashCode();
356         }
357         
358         return result;
359     }
360
361     /**
362      * Method isValid.
363      * 
364      * @return true if this object is valid according to the schema
365      */
366     public boolean isValid(
367     ) {
368         try {
369             validate();
370         } catch (org.exolab.castor.xml.ValidationException vex) {
371             return false;
372         }
373         return true;
374     }
375
376     /**
377      * 
378      * 
379      * @param out
380      * @throws org.exolab.castor.xml.MarshalException if object is
381      * null or if any SAXException is thrown during marshaling
382      * @throws org.exolab.castor.xml.ValidationException if this
383      * object is an invalid instance according to the schema
384      */
385     public void marshal(
386             final java.io.Writer out)
387     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
388         Marshaller.marshal(this, out);
389     }
390
391     /**
392      * 
393      * 
394      * @param handler
395      * @throws java.io.IOException if an IOException occurs during
396      * marshaling
397      * @throws org.exolab.castor.xml.ValidationException if this
398      * object is an invalid instance according to the schema
399      * @throws org.exolab.castor.xml.MarshalException if object is
400      * null or if any SAXException is thrown during marshaling
401      */
402     public void marshal(
403             final org.xml.sax.ContentHandler handler)
404     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
405         Marshaller.marshal(this, handler);
406     }
407
408     /**
409      */
410     public void removeAllDataSet(
411     ) {
412         this._dataSetList.clear();
413     }
414
415     /**
416      */
417     public void removeAllTree(
418     ) {
419         this._treeList.clear();
420     }
421
422     /**
423      * Method removeDataSet.
424      * 
425      * @param vDataSet
426      * @return true if the object was removed from the collection.
427      */
428     public boolean removeDataSet(
429             final uk.ac.vamsas.objects.core.DataSet vDataSet) {
430         boolean removed = _dataSetList.remove(vDataSet);
431         return removed;
432     }
433
434     /**
435      * Method removeDataSetAt.
436      * 
437      * @param index
438      * @return the element removed from the collection
439      */
440     public uk.ac.vamsas.objects.core.DataSet removeDataSetAt(
441             final int index) {
442         java.lang.Object obj = this._dataSetList.remove(index);
443         return (uk.ac.vamsas.objects.core.DataSet) obj;
444     }
445
446     /**
447      * Method removeTree.
448      * 
449      * @param vTree
450      * @return true if the object was removed from the collection.
451      */
452     public boolean removeTree(
453             final uk.ac.vamsas.objects.core.Tree vTree) {
454         boolean removed = _treeList.remove(vTree);
455         return removed;
456     }
457
458     /**
459      * Method removeTreeAt.
460      * 
461      * @param index
462      * @return the element removed from the collection
463      */
464     public uk.ac.vamsas.objects.core.Tree removeTreeAt(
465             final int index) {
466         java.lang.Object obj = this._treeList.remove(index);
467         return (uk.ac.vamsas.objects.core.Tree) obj;
468     }
469
470     /**
471      * 
472      * 
473      * @param index
474      * @param vDataSet
475      * @throws java.lang.IndexOutOfBoundsException if the index
476      * given is outside the bounds of the collection
477      */
478     public void setDataSet(
479             final int index,
480             final uk.ac.vamsas.objects.core.DataSet vDataSet)
481     throws java.lang.IndexOutOfBoundsException {
482         // check bounds for index
483         if (index < 0 || index >= this._dataSetList.size()) {
484             throw new IndexOutOfBoundsException("setDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
485         }
486         
487         this._dataSetList.set(index, vDataSet);
488     }
489
490     /**
491      * 
492      * 
493      * @param vDataSetArray
494      */
495     public void setDataSet(
496             final uk.ac.vamsas.objects.core.DataSet[] vDataSetArray) {
497         //-- copy array
498         _dataSetList.clear();
499         
500         for (int i = 0; i < vDataSetArray.length; i++) {
501                 this._dataSetList.add(vDataSetArray[i]);
502         }
503     }
504
505     /**
506      * Sets the value of '_dataSetList' by copying the given
507      * Vector. All elements will be checked for type safety.
508      * 
509      * @param vDataSetList the Vector to copy.
510      */
511     public void setDataSet(
512             final java.util.Vector vDataSetList) {
513         // copy vector
514         this._dataSetList.clear();
515         
516         this._dataSetList.addAll(vDataSetList);
517     }
518
519     /**
520      * Sets the value of '_dataSetList' by setting it to the given
521      * Vector. No type checking is performed.
522      * @deprecated
523      * 
524      * @param dataSetVector the Vector to set.
525      */
526     public void setDataSetAsReference(
527             final java.util.Vector dataSetVector) {
528         this._dataSetList = dataSetVector;
529     }
530
531     /**
532      * Sets the value of field 'id'. The field 'id' has the
533      * following description: Primary Key for vamsas object
534      * referencing 
535      * 
536      * @param id the value of field 'id'.
537      */
538     public void setId(
539             final java.lang.String id) {
540         this._id = id;
541     }
542
543     /**
544      * Sets the value of field 'modifiable'.
545      * 
546      * @param modifiable the value of field 'modifiable'.
547      */
548     public void setModifiable(
549             final java.lang.String modifiable) {
550         this._modifiable = modifiable;
551     }
552
553     /**
554      * 
555      * 
556      * @param index
557      * @param vTree
558      * @throws java.lang.IndexOutOfBoundsException if the index
559      * given is outside the bounds of the collection
560      */
561     public void setTree(
562             final int index,
563             final uk.ac.vamsas.objects.core.Tree vTree)
564     throws java.lang.IndexOutOfBoundsException {
565         // check bounds for index
566         if (index < 0 || index >= this._treeList.size()) {
567             throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
568         }
569         
570         this._treeList.set(index, vTree);
571     }
572
573     /**
574      * 
575      * 
576      * @param vTreeArray
577      */
578     public void setTree(
579             final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
580         //-- copy array
581         _treeList.clear();
582         
583         for (int i = 0; i < vTreeArray.length; i++) {
584                 this._treeList.add(vTreeArray[i]);
585         }
586     }
587
588     /**
589      * Sets the value of '_treeList' by copying the given Vector.
590      * All elements will be checked for type safety.
591      * 
592      * @param vTreeList the Vector to copy.
593      */
594     public void setTree(
595             final java.util.Vector vTreeList) {
596         // copy vector
597         this._treeList.clear();
598         
599         this._treeList.addAll(vTreeList);
600     }
601
602     /**
603      * Sets the value of '_treeList' by setting it to the given
604      * Vector. No type checking is performed.
605      * @deprecated
606      * 
607      * @param treeVector the Vector to set.
608      */
609     public void setTreeAsReference(
610             final java.util.Vector treeVector) {
611         this._treeList = treeVector;
612     }
613
614     /**
615      * Method unmarshal.
616      * 
617      * @param reader
618      * @throws org.exolab.castor.xml.MarshalException if object is
619      * null or if any SAXException is thrown during marshaling
620      * @throws org.exolab.castor.xml.ValidationException if this
621      * object is an invalid instance according to the schema
622      * @return the unmarshaled uk.ac.vamsas.objects.core.VAMSAS
623      */
624     public static uk.ac.vamsas.objects.core.VAMSAS unmarshal(
625             final java.io.Reader reader)
626     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
627         return (uk.ac.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VAMSAS.class, reader);
628     }
629
630     /**
631      * 
632      * 
633      * @throws org.exolab.castor.xml.ValidationException if this
634      * object is an invalid instance according to the schema
635      */
636     public void validate(
637     )
638     throws org.exolab.castor.xml.ValidationException {
639         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
640         validator.validate(this);
641     }
642
643 }