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