9a6d4327e629f18186a803ee4d1db18429d0da71
[vamsas.git] / src / org / vamsas / objects / core / Alignment.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package org.vamsas.objects.core;
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.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26 /**
27  * Class Alignment.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class Alignment extends org.vamsas.client.object 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _id
42      */
43     private java.lang.String _id;
44
45     /**
46      * Field _alignmentAnnotations
47      */
48     private org.vamsas.objects.core.AlignmentAnnotations _alignmentAnnotations;
49
50     /**
51      * Field _treeList
52      */
53     private java.util.Vector _treeList;
54
55     /**
56      * Field _alignmentSequenceList
57      */
58     private java.util.Vector _alignmentSequenceList;
59
60     /**
61      * Field _provenance
62      */
63     private org.vamsas.objects.core.Provenance _provenance;
64
65
66       //----------------/
67      //- Constructors -/
68     //----------------/
69
70     public Alignment() 
71      {
72         super();
73         _treeList = new Vector();
74         _alignmentSequenceList = new Vector();
75     } //-- org.vamsas.objects.core.Alignment()
76
77
78       //-----------/
79      //- Methods -/
80     //-----------/
81
82     /**
83      * Method addAlignmentSequence
84      * 
85      * 
86      * 
87      * @param vAlignmentSequence
88      */
89     public void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
90         throws java.lang.IndexOutOfBoundsException
91     {
92         _alignmentSequenceList.addElement(vAlignmentSequence);
93     } //-- void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
94
95     /**
96      * Method addAlignmentSequence
97      * 
98      * 
99      * 
100      * @param index
101      * @param vAlignmentSequence
102      */
103     public void addAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
104         throws java.lang.IndexOutOfBoundsException
105     {
106         _alignmentSequenceList.insertElementAt(vAlignmentSequence, index);
107     } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
108
109     /**
110      * Method addTree
111      * 
112      * 
113      * 
114      * @param vTree
115      */
116     public void addTree(org.vamsas.objects.core.Tree vTree)
117         throws java.lang.IndexOutOfBoundsException
118     {
119         _treeList.addElement(vTree);
120     } //-- void addTree(org.vamsas.objects.core.Tree) 
121
122     /**
123      * Method addTree
124      * 
125      * 
126      * 
127      * @param index
128      * @param vTree
129      */
130     public void addTree(int index, org.vamsas.objects.core.Tree vTree)
131         throws java.lang.IndexOutOfBoundsException
132     {
133         _treeList.insertElementAt(vTree, index);
134     } //-- void addTree(int, org.vamsas.objects.core.Tree) 
135
136     /**
137      * Method enumerateAlignmentSequence
138      * 
139      * 
140      * 
141      * @return Enumeration
142      */
143     public java.util.Enumeration enumerateAlignmentSequence()
144     {
145         return _alignmentSequenceList.elements();
146     } //-- java.util.Enumeration enumerateAlignmentSequence() 
147
148     /**
149      * Method enumerateTree
150      * 
151      * 
152      * 
153      * @return Enumeration
154      */
155     public java.util.Enumeration enumerateTree()
156     {
157         return _treeList.elements();
158     } //-- java.util.Enumeration enumerateTree() 
159
160     /**
161      * Note: hashCode() has not been overriden
162      * 
163      * @param obj
164      * @return boolean
165      */
166     public boolean equals(java.lang.Object obj)
167     {
168         if ( this == obj )
169             return true;
170         
171         if (super.equals(obj)==false)
172             return false;
173         
174         if (obj instanceof Alignment) {
175         
176             Alignment temp = (Alignment)obj;
177             if (this._id != null) {
178                 if (temp._id == null) return false;
179                 else if (!(this._id.equals(temp._id))) 
180                     return false;
181             }
182             else if (temp._id != null)
183                 return false;
184             if (this._alignmentAnnotations != null) {
185                 if (temp._alignmentAnnotations == null) return false;
186                 else if (!(this._alignmentAnnotations.equals(temp._alignmentAnnotations))) 
187                     return false;
188             }
189             else if (temp._alignmentAnnotations != null)
190                 return false;
191             if (this._treeList != null) {
192                 if (temp._treeList == null) return false;
193                 else if (!(this._treeList.equals(temp._treeList))) 
194                     return false;
195             }
196             else if (temp._treeList != null)
197                 return false;
198             if (this._alignmentSequenceList != null) {
199                 if (temp._alignmentSequenceList == null) return false;
200                 else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList))) 
201                     return false;
202             }
203             else if (temp._alignmentSequenceList != null)
204                 return false;
205             if (this._provenance != null) {
206                 if (temp._provenance == null) return false;
207                 else if (!(this._provenance.equals(temp._provenance))) 
208                     return false;
209             }
210             else if (temp._provenance != null)
211                 return false;
212             return true;
213         }
214         return false;
215     } //-- boolean equals(java.lang.Object) 
216
217     /**
218      * Returns the value of field 'alignmentAnnotations'.
219      * 
220      * @return AlignmentAnnotations
221      * @return the value of field 'alignmentAnnotations'.
222      */
223     public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations()
224     {
225         return this._alignmentAnnotations;
226     } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() 
227
228     /**
229      * Method getAlignmentSequence
230      * 
231      * 
232      * 
233      * @param index
234      * @return AlignmentSequence
235      */
236     public org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index)
237         throws java.lang.IndexOutOfBoundsException
238     {
239         //-- check bounds for index
240         if ((index < 0) || (index > _alignmentSequenceList.size())) {
241             throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
242         }
243         
244         return (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
245     } //-- org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int) 
246
247     /**
248      * Method getAlignmentSequence
249      * 
250      * 
251      * 
252      * @return AlignmentSequence
253      */
254     public org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
255     {
256         int size = _alignmentSequenceList.size();
257         org.vamsas.objects.core.AlignmentSequence[] mArray = new org.vamsas.objects.core.AlignmentSequence[size];
258         for (int index = 0; index < size; index++) {
259             mArray[index] = (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
260         }
261         return mArray;
262     } //-- org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() 
263
264     /**
265      * Method getAlignmentSequenceCount
266      * 
267      * 
268      * 
269      * @return int
270      */
271     public int getAlignmentSequenceCount()
272     {
273         return _alignmentSequenceList.size();
274     } //-- int getAlignmentSequenceCount() 
275
276     /**
277      * Returns the value of field 'id'.
278      * 
279      * @return String
280      * @return the value of field 'id'.
281      */
282     public java.lang.String getId()
283     {
284         return this._id;
285     } //-- java.lang.String getId() 
286
287     /**
288      * Returns the value of field 'provenance'.
289      * 
290      * @return Provenance
291      * @return the value of field 'provenance'.
292      */
293     public org.vamsas.objects.core.Provenance getProvenance()
294     {
295         return this._provenance;
296     } //-- org.vamsas.objects.core.Provenance getProvenance() 
297
298     /**
299      * Method getTree
300      * 
301      * 
302      * 
303      * @param index
304      * @return Tree
305      */
306     public org.vamsas.objects.core.Tree getTree(int index)
307         throws java.lang.IndexOutOfBoundsException
308     {
309         //-- check bounds for index
310         if ((index < 0) || (index > _treeList.size())) {
311             throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
312         }
313         
314         return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
315     } //-- org.vamsas.objects.core.Tree getTree(int) 
316
317     /**
318      * Method getTree
319      * 
320      * 
321      * 
322      * @return Tree
323      */
324     public org.vamsas.objects.core.Tree[] getTree()
325     {
326         int size = _treeList.size();
327         org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
328         for (int index = 0; index < size; index++) {
329             mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
330         }
331         return mArray;
332     } //-- org.vamsas.objects.core.Tree[] getTree() 
333
334     /**
335      * Method getTreeCount
336      * 
337      * 
338      * 
339      * @return int
340      */
341     public int getTreeCount()
342     {
343         return _treeList.size();
344     } //-- int getTreeCount() 
345
346     /**
347      * Method isValid
348      * 
349      * 
350      * 
351      * @return boolean
352      */
353     public boolean isValid()
354     {
355         try {
356             validate();
357         }
358         catch (org.exolab.castor.xml.ValidationException vex) {
359             return false;
360         }
361         return true;
362     } //-- boolean isValid() 
363
364     /**
365      * Method marshal
366      * 
367      * 
368      * 
369      * @param out
370      */
371     public void marshal(java.io.Writer out)
372         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
373     {
374         
375         Marshaller.marshal(this, out);
376     } //-- void marshal(java.io.Writer) 
377
378     /**
379      * Method marshal
380      * 
381      * 
382      * 
383      * @param handler
384      */
385     public void marshal(org.xml.sax.ContentHandler handler)
386         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
387     {
388         
389         Marshaller.marshal(this, handler);
390     } //-- void marshal(org.xml.sax.ContentHandler) 
391
392     /**
393      * Method removeAlignmentSequence
394      * 
395      * 
396      * 
397      * @param index
398      * @return AlignmentSequence
399      */
400     public org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index)
401     {
402         java.lang.Object obj = _alignmentSequenceList.elementAt(index);
403         _alignmentSequenceList.removeElementAt(index);
404         return (org.vamsas.objects.core.AlignmentSequence) obj;
405     } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) 
406
407     /**
408      * Method removeAllAlignmentSequence
409      * 
410      */
411     public void removeAllAlignmentSequence()
412     {
413         _alignmentSequenceList.removeAllElements();
414     } //-- void removeAllAlignmentSequence() 
415
416     /**
417      * Method removeAllTree
418      * 
419      */
420     public void removeAllTree()
421     {
422         _treeList.removeAllElements();
423     } //-- void removeAllTree() 
424
425     /**
426      * Method removeTree
427      * 
428      * 
429      * 
430      * @param index
431      * @return Tree
432      */
433     public org.vamsas.objects.core.Tree removeTree(int index)
434     {
435         java.lang.Object obj = _treeList.elementAt(index);
436         _treeList.removeElementAt(index);
437         return (org.vamsas.objects.core.Tree) obj;
438     } //-- org.vamsas.objects.core.Tree removeTree(int) 
439
440     /**
441      * Sets the value of field 'alignmentAnnotations'.
442      * 
443      * @param alignmentAnnotations the value of field
444      * 'alignmentAnnotations'.
445      */
446     public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations alignmentAnnotations)
447     {
448         this._alignmentAnnotations = alignmentAnnotations;
449     } //-- void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
450
451     /**
452      * Method setAlignmentSequence
453      * 
454      * 
455      * 
456      * @param index
457      * @param vAlignmentSequence
458      */
459     public void setAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
460         throws java.lang.IndexOutOfBoundsException
461     {
462         //-- check bounds for index
463         if ((index < 0) || (index > _alignmentSequenceList.size())) {
464             throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
465         }
466         _alignmentSequenceList.setElementAt(vAlignmentSequence, index);
467     } //-- void setAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
468
469     /**
470      * Method setAlignmentSequence
471      * 
472      * 
473      * 
474      * @param alignmentSequenceArray
475      */
476     public void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray)
477     {
478         //-- copy array
479         _alignmentSequenceList.removeAllElements();
480         for (int i = 0; i < alignmentSequenceArray.length; i++) {
481             _alignmentSequenceList.addElement(alignmentSequenceArray[i]);
482         }
483     } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
484
485     /**
486      * Sets the value of field 'id'.
487      * 
488      * @param id the value of field 'id'.
489      */
490     public void setId(java.lang.String id)
491     {
492         this._id = id;
493     } //-- void setId(java.lang.String) 
494
495     /**
496      * Sets the value of field 'provenance'.
497      * 
498      * @param provenance the value of field 'provenance'.
499      */
500     public void setProvenance(org.vamsas.objects.core.Provenance provenance)
501     {
502         this._provenance = provenance;
503     } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
504
505     /**
506      * Method setTree
507      * 
508      * 
509      * 
510      * @param index
511      * @param vTree
512      */
513     public void setTree(int index, org.vamsas.objects.core.Tree vTree)
514         throws java.lang.IndexOutOfBoundsException
515     {
516         //-- check bounds for index
517         if ((index < 0) || (index > _treeList.size())) {
518             throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
519         }
520         _treeList.setElementAt(vTree, index);
521     } //-- void setTree(int, org.vamsas.objects.core.Tree) 
522
523     /**
524      * Method setTree
525      * 
526      * 
527      * 
528      * @param treeArray
529      */
530     public void setTree(org.vamsas.objects.core.Tree[] treeArray)
531     {
532         //-- copy array
533         _treeList.removeAllElements();
534         for (int i = 0; i < treeArray.length; i++) {
535             _treeList.addElement(treeArray[i]);
536         }
537     } //-- void setTree(org.vamsas.objects.core.Tree) 
538
539     /**
540      * Method unmarshal
541      * 
542      * 
543      * 
544      * @param reader
545      * @return Alignment
546      */
547     public static org.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader)
548         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
549     {
550         return (org.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(org.vamsas.objects.core.Alignment.class, reader);
551     } //-- org.vamsas.objects.core.Alignment unmarshal(java.io.Reader) 
552
553     /**
554      * Method validate
555      * 
556      */
557     public void validate()
558         throws org.exolab.castor.xml.ValidationException
559     {
560         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
561         validator.validate(this);
562     } //-- void validate() 
563
564 }