7c6adc5136aae4469efec6ce1d80aee7aefdf9a8
[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.Vobject 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _gapChar
42      */
43     private java.lang.String _gapChar;
44
45     /**
46      * Field _aligned
47      */
48     private boolean _aligned;
49
50     /**
51      * keeps track of state for field: _aligned
52      */
53     private boolean _has_aligned;
54
55     /**
56      * Field _id
57      */
58     private java.lang.String _id;
59
60     /**
61      * Field _alignmentAnnotationsList
62      */
63     private java.util.Vector _alignmentAnnotationsList;
64
65     /**
66      * Field _treeList
67      */
68     private java.util.Vector _treeList;
69
70     /**
71      * Field _alignmentSequenceList
72      */
73     private java.util.Vector _alignmentSequenceList;
74
75     /**
76      * Field _provenance
77      */
78     private org.vamsas.objects.core.Provenance _provenance;
79
80
81       //----------------/
82      //- Constructors -/
83     //----------------/
84
85     public Alignment() 
86      {
87         super();
88         _alignmentAnnotationsList = new Vector();
89         _treeList = new Vector();
90         _alignmentSequenceList = new Vector();
91     } //-- org.vamsas.objects.core.Alignment()
92
93
94       //-----------/
95      //- Methods -/
96     //-----------/
97
98     /**
99      * Method addAlignmentAnnotations
100      * 
101      * 
102      * 
103      * @param vAlignmentAnnotations
104      */
105     public void addAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations vAlignmentAnnotations)
106         throws java.lang.IndexOutOfBoundsException
107     {
108         _alignmentAnnotationsList.addElement(vAlignmentAnnotations);
109     } //-- void addAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
110
111     /**
112      * Method addAlignmentAnnotations
113      * 
114      * 
115      * 
116      * @param index
117      * @param vAlignmentAnnotations
118      */
119     public void addAlignmentAnnotations(int index, org.vamsas.objects.core.AlignmentAnnotations vAlignmentAnnotations)
120         throws java.lang.IndexOutOfBoundsException
121     {
122         _alignmentAnnotationsList.insertElementAt(vAlignmentAnnotations, index);
123     } //-- void addAlignmentAnnotations(int, org.vamsas.objects.core.AlignmentAnnotations) 
124
125     /**
126      * Method addAlignmentSequence
127      * 
128      * 
129      * 
130      * @param vAlignmentSequence
131      */
132     public void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
133         throws java.lang.IndexOutOfBoundsException
134     {
135         _alignmentSequenceList.addElement(vAlignmentSequence);
136     } //-- void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
137
138     /**
139      * Method addAlignmentSequence
140      * 
141      * 
142      * 
143      * @param index
144      * @param vAlignmentSequence
145      */
146     public void addAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
147         throws java.lang.IndexOutOfBoundsException
148     {
149         _alignmentSequenceList.insertElementAt(vAlignmentSequence, index);
150     } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
151
152     /**
153      * Method addTree
154      * 
155      * 
156      * 
157      * @param vTree
158      */
159     public void addTree(org.vamsas.objects.core.Tree vTree)
160         throws java.lang.IndexOutOfBoundsException
161     {
162         _treeList.addElement(vTree);
163     } //-- void addTree(org.vamsas.objects.core.Tree) 
164
165     /**
166      * Method addTree
167      * 
168      * 
169      * 
170      * @param index
171      * @param vTree
172      */
173     public void addTree(int index, org.vamsas.objects.core.Tree vTree)
174         throws java.lang.IndexOutOfBoundsException
175     {
176         _treeList.insertElementAt(vTree, index);
177     } //-- void addTree(int, org.vamsas.objects.core.Tree) 
178
179     /**
180      * Method deleteAligned
181      * 
182      */
183     public void deleteAligned()
184     {
185         this._has_aligned= false;
186     } //-- void deleteAligned() 
187
188     /**
189      * Method enumerateAlignmentAnnotations
190      * 
191      * 
192      * 
193      * @return Enumeration
194      */
195     public java.util.Enumeration enumerateAlignmentAnnotations()
196     {
197         return _alignmentAnnotationsList.elements();
198     } //-- java.util.Enumeration enumerateAlignmentAnnotations() 
199
200     /**
201      * Method enumerateAlignmentSequence
202      * 
203      * 
204      * 
205      * @return Enumeration
206      */
207     public java.util.Enumeration enumerateAlignmentSequence()
208     {
209         return _alignmentSequenceList.elements();
210     } //-- java.util.Enumeration enumerateAlignmentSequence() 
211
212     /**
213      * Method enumerateTree
214      * 
215      * 
216      * 
217      * @return Enumeration
218      */
219     public java.util.Enumeration enumerateTree()
220     {
221         return _treeList.elements();
222     } //-- java.util.Enumeration enumerateTree() 
223
224     /**
225      * Note: hashCode() has not been overriden
226      * 
227      * @param obj
228      * @return boolean
229      */
230     public boolean equals(java.lang.Object obj)
231     {
232         if ( this == obj )
233             return true;
234         
235         if (super.equals(obj)==false)
236             return false;
237         
238         if (obj instanceof Alignment) {
239         
240             Alignment temp = (Alignment)obj;
241             if (this._gapChar != null) {
242                 if (temp._gapChar == null) return false;
243                 else if (!(this._gapChar.equals(temp._gapChar))) 
244                     return false;
245             }
246             else if (temp._gapChar != null)
247                 return false;
248             if (this._aligned != temp._aligned)
249                 return false;
250             if (this._has_aligned != temp._has_aligned)
251                 return false;
252             if (this._id != null) {
253                 if (temp._id == null) return false;
254                 else if (!(this._id.equals(temp._id))) 
255                     return false;
256             }
257             else if (temp._id != null)
258                 return false;
259             if (this._alignmentAnnotationsList != null) {
260                 if (temp._alignmentAnnotationsList == null) return false;
261                 else if (!(this._alignmentAnnotationsList.equals(temp._alignmentAnnotationsList))) 
262                     return false;
263             }
264             else if (temp._alignmentAnnotationsList != null)
265                 return false;
266             if (this._treeList != null) {
267                 if (temp._treeList == null) return false;
268                 else if (!(this._treeList.equals(temp._treeList))) 
269                     return false;
270             }
271             else if (temp._treeList != null)
272                 return false;
273             if (this._alignmentSequenceList != null) {
274                 if (temp._alignmentSequenceList == null) return false;
275                 else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList))) 
276                     return false;
277             }
278             else if (temp._alignmentSequenceList != null)
279                 return false;
280             if (this._provenance != null) {
281                 if (temp._provenance == null) return false;
282                 else if (!(this._provenance.equals(temp._provenance))) 
283                     return false;
284             }
285             else if (temp._provenance != null)
286                 return false;
287             return true;
288         }
289         return false;
290     } //-- boolean equals(java.lang.Object) 
291
292     /**
293      * Returns the value of field 'aligned'.
294      * 
295      * @return boolean
296      * @return the value of field 'aligned'.
297      */
298     public boolean getAligned()
299     {
300         return this._aligned;
301     } //-- boolean getAligned() 
302
303     /**
304      * Method getAlignmentAnnotations
305      * 
306      * 
307      * 
308      * @param index
309      * @return AlignmentAnnotations
310      */
311     public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations(int index)
312         throws java.lang.IndexOutOfBoundsException
313     {
314         //-- check bounds for index
315         if ((index < 0) || (index > _alignmentAnnotationsList.size())) {
316             throw new IndexOutOfBoundsException("getAlignmentAnnotations: Index value '"+index+"' not in range [0.."+_alignmentAnnotationsList.size()+ "]");
317         }
318         
319         return (org.vamsas.objects.core.AlignmentAnnotations) _alignmentAnnotationsList.elementAt(index);
320     } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations(int) 
321
322     /**
323      * Method getAlignmentAnnotations
324      * 
325      * 
326      * 
327      * @return AlignmentAnnotations
328      */
329     public org.vamsas.objects.core.AlignmentAnnotations[] getAlignmentAnnotations()
330     {
331         int size = _alignmentAnnotationsList.size();
332         org.vamsas.objects.core.AlignmentAnnotations[] mArray = new org.vamsas.objects.core.AlignmentAnnotations[size];
333         for (int index = 0; index < size; index++) {
334             mArray[index] = (org.vamsas.objects.core.AlignmentAnnotations) _alignmentAnnotationsList.elementAt(index);
335         }
336         return mArray;
337     } //-- org.vamsas.objects.core.AlignmentAnnotations[] getAlignmentAnnotations() 
338
339     /**
340      * Method getAlignmentAnnotationsCount
341      * 
342      * 
343      * 
344      * @return int
345      */
346     public int getAlignmentAnnotationsCount()
347     {
348         return _alignmentAnnotationsList.size();
349     } //-- int getAlignmentAnnotationsCount() 
350
351     /**
352      * Method getAlignmentSequence
353      * 
354      * 
355      * 
356      * @param index
357      * @return AlignmentSequence
358      */
359     public org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index)
360         throws java.lang.IndexOutOfBoundsException
361     {
362         //-- check bounds for index
363         if ((index < 0) || (index > _alignmentSequenceList.size())) {
364             throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
365         }
366         
367         return (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
368     } //-- org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int) 
369
370     /**
371      * Method getAlignmentSequence
372      * 
373      * 
374      * 
375      * @return AlignmentSequence
376      */
377     public org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
378     {
379         int size = _alignmentSequenceList.size();
380         org.vamsas.objects.core.AlignmentSequence[] mArray = new org.vamsas.objects.core.AlignmentSequence[size];
381         for (int index = 0; index < size; index++) {
382             mArray[index] = (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
383         }
384         return mArray;
385     } //-- org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() 
386
387     /**
388      * Method getAlignmentSequenceCount
389      * 
390      * 
391      * 
392      * @return int
393      */
394     public int getAlignmentSequenceCount()
395     {
396         return _alignmentSequenceList.size();
397     } //-- int getAlignmentSequenceCount() 
398
399     /**
400      * Returns the value of field 'gapChar'.
401      * 
402      * @return String
403      * @return the value of field 'gapChar'.
404      */
405     public java.lang.String getGapChar()
406     {
407         return this._gapChar;
408     } //-- java.lang.String getGapChar() 
409
410     /**
411      * Returns the value of field 'id'.
412      * 
413      * @return String
414      * @return the value of field 'id'.
415      */
416     public java.lang.String getId()
417     {
418         return this._id;
419     } //-- java.lang.String getId() 
420
421     /**
422      * Returns the value of field 'provenance'.
423      * 
424      * @return Provenance
425      * @return the value of field 'provenance'.
426      */
427     public org.vamsas.objects.core.Provenance getProvenance()
428     {
429         return this._provenance;
430     } //-- org.vamsas.objects.core.Provenance getProvenance() 
431
432     /**
433      * Method getTree
434      * 
435      * 
436      * 
437      * @param index
438      * @return Tree
439      */
440     public org.vamsas.objects.core.Tree getTree(int index)
441         throws java.lang.IndexOutOfBoundsException
442     {
443         //-- check bounds for index
444         if ((index < 0) || (index > _treeList.size())) {
445             throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
446         }
447         
448         return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
449     } //-- org.vamsas.objects.core.Tree getTree(int) 
450
451     /**
452      * Method getTree
453      * 
454      * 
455      * 
456      * @return Tree
457      */
458     public org.vamsas.objects.core.Tree[] getTree()
459     {
460         int size = _treeList.size();
461         org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
462         for (int index = 0; index < size; index++) {
463             mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
464         }
465         return mArray;
466     } //-- org.vamsas.objects.core.Tree[] getTree() 
467
468     /**
469      * Method getTreeCount
470      * 
471      * 
472      * 
473      * @return int
474      */
475     public int getTreeCount()
476     {
477         return _treeList.size();
478     } //-- int getTreeCount() 
479
480     /**
481      * Method hasAligned
482      * 
483      * 
484      * 
485      * @return boolean
486      */
487     public boolean hasAligned()
488     {
489         return this._has_aligned;
490     } //-- boolean hasAligned() 
491
492     /**
493      * Method isValid
494      * 
495      * 
496      * 
497      * @return boolean
498      */
499     public boolean isValid()
500     {
501         try {
502             validate();
503         }
504         catch (org.exolab.castor.xml.ValidationException vex) {
505             return false;
506         }
507         return true;
508     } //-- boolean isValid() 
509
510     /**
511      * Method marshal
512      * 
513      * 
514      * 
515      * @param out
516      */
517     public void marshal(java.io.Writer out)
518         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
519     {
520         
521         Marshaller.marshal(this, out);
522     } //-- void marshal(java.io.Writer) 
523
524     /**
525      * Method marshal
526      * 
527      * 
528      * 
529      * @param handler
530      */
531     public void marshal(org.xml.sax.ContentHandler handler)
532         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
533     {
534         
535         Marshaller.marshal(this, handler);
536     } //-- void marshal(org.xml.sax.ContentHandler) 
537
538     /**
539      * Method removeAlignmentAnnotations
540      * 
541      * 
542      * 
543      * @param index
544      * @return AlignmentAnnotations
545      */
546     public org.vamsas.objects.core.AlignmentAnnotations removeAlignmentAnnotations(int index)
547     {
548         java.lang.Object obj = _alignmentAnnotationsList.elementAt(index);
549         _alignmentAnnotationsList.removeElementAt(index);
550         return (org.vamsas.objects.core.AlignmentAnnotations) obj;
551     } //-- org.vamsas.objects.core.AlignmentAnnotations removeAlignmentAnnotations(int) 
552
553     /**
554      * Method removeAlignmentSequence
555      * 
556      * 
557      * 
558      * @param index
559      * @return AlignmentSequence
560      */
561     public org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index)
562     {
563         java.lang.Object obj = _alignmentSequenceList.elementAt(index);
564         _alignmentSequenceList.removeElementAt(index);
565         return (org.vamsas.objects.core.AlignmentSequence) obj;
566     } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) 
567
568     /**
569      * Method removeAllAlignmentAnnotations
570      * 
571      */
572     public void removeAllAlignmentAnnotations()
573     {
574         _alignmentAnnotationsList.removeAllElements();
575     } //-- void removeAllAlignmentAnnotations() 
576
577     /**
578      * Method removeAllAlignmentSequence
579      * 
580      */
581     public void removeAllAlignmentSequence()
582     {
583         _alignmentSequenceList.removeAllElements();
584     } //-- void removeAllAlignmentSequence() 
585
586     /**
587      * Method removeAllTree
588      * 
589      */
590     public void removeAllTree()
591     {
592         _treeList.removeAllElements();
593     } //-- void removeAllTree() 
594
595     /**
596      * Method removeTree
597      * 
598      * 
599      * 
600      * @param index
601      * @return Tree
602      */
603     public org.vamsas.objects.core.Tree removeTree(int index)
604     {
605         java.lang.Object obj = _treeList.elementAt(index);
606         _treeList.removeElementAt(index);
607         return (org.vamsas.objects.core.Tree) obj;
608     } //-- org.vamsas.objects.core.Tree removeTree(int) 
609
610     /**
611      * Sets the value of field 'aligned'.
612      * 
613      * @param aligned the value of field 'aligned'.
614      */
615     public void setAligned(boolean aligned)
616     {
617         this._aligned = aligned;
618         this._has_aligned = true;
619     } //-- void setAligned(boolean) 
620
621     /**
622      * Method setAlignmentAnnotations
623      * 
624      * 
625      * 
626      * @param index
627      * @param vAlignmentAnnotations
628      */
629     public void setAlignmentAnnotations(int index, org.vamsas.objects.core.AlignmentAnnotations vAlignmentAnnotations)
630         throws java.lang.IndexOutOfBoundsException
631     {
632         //-- check bounds for index
633         if ((index < 0) || (index > _alignmentAnnotationsList.size())) {
634             throw new IndexOutOfBoundsException("setAlignmentAnnotations: Index value '"+index+"' not in range [0.."+_alignmentAnnotationsList.size()+ "]");
635         }
636         _alignmentAnnotationsList.setElementAt(vAlignmentAnnotations, index);
637     } //-- void setAlignmentAnnotations(int, org.vamsas.objects.core.AlignmentAnnotations) 
638
639     /**
640      * Method setAlignmentAnnotations
641      * 
642      * 
643      * 
644      * @param alignmentAnnotationsArray
645      */
646     public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations[] alignmentAnnotationsArray)
647     {
648         //-- copy array
649         _alignmentAnnotationsList.removeAllElements();
650         for (int i = 0; i < alignmentAnnotationsArray.length; i++) {
651             _alignmentAnnotationsList.addElement(alignmentAnnotationsArray[i]);
652         }
653     } //-- void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
654
655     /**
656      * Method setAlignmentSequence
657      * 
658      * 
659      * 
660      * @param index
661      * @param vAlignmentSequence
662      */
663     public void setAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
664         throws java.lang.IndexOutOfBoundsException
665     {
666         //-- check bounds for index
667         if ((index < 0) || (index > _alignmentSequenceList.size())) {
668             throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
669         }
670         _alignmentSequenceList.setElementAt(vAlignmentSequence, index);
671     } //-- void setAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
672
673     /**
674      * Method setAlignmentSequence
675      * 
676      * 
677      * 
678      * @param alignmentSequenceArray
679      */
680     public void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray)
681     {
682         //-- copy array
683         _alignmentSequenceList.removeAllElements();
684         for (int i = 0; i < alignmentSequenceArray.length; i++) {
685             _alignmentSequenceList.addElement(alignmentSequenceArray[i]);
686         }
687     } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
688
689     /**
690      * Sets the value of field 'gapChar'.
691      * 
692      * @param gapChar the value of field 'gapChar'.
693      */
694     public void setGapChar(java.lang.String gapChar)
695     {
696         this._gapChar = gapChar;
697     } //-- void setGapChar(java.lang.String) 
698
699     /**
700      * Sets the value of field 'id'.
701      * 
702      * @param id the value of field 'id'.
703      */
704     public void setId(java.lang.String id)
705     {
706         this._id = id;
707     } //-- void setId(java.lang.String) 
708
709     /**
710      * Sets the value of field 'provenance'.
711      * 
712      * @param provenance the value of field 'provenance'.
713      */
714     public void setProvenance(org.vamsas.objects.core.Provenance provenance)
715     {
716         this._provenance = provenance;
717     } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
718
719     /**
720      * Method setTree
721      * 
722      * 
723      * 
724      * @param index
725      * @param vTree
726      */
727     public void setTree(int index, org.vamsas.objects.core.Tree vTree)
728         throws java.lang.IndexOutOfBoundsException
729     {
730         //-- check bounds for index
731         if ((index < 0) || (index > _treeList.size())) {
732             throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
733         }
734         _treeList.setElementAt(vTree, index);
735     } //-- void setTree(int, org.vamsas.objects.core.Tree) 
736
737     /**
738      * Method setTree
739      * 
740      * 
741      * 
742      * @param treeArray
743      */
744     public void setTree(org.vamsas.objects.core.Tree[] treeArray)
745     {
746         //-- copy array
747         _treeList.removeAllElements();
748         for (int i = 0; i < treeArray.length; i++) {
749             _treeList.addElement(treeArray[i]);
750         }
751     } //-- void setTree(org.vamsas.objects.core.Tree) 
752
753     /**
754      * Method unmarshal
755      * 
756      * 
757      * 
758      * @param reader
759      * @return Alignment
760      */
761     public static org.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader)
762         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
763     {
764         return (org.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(org.vamsas.objects.core.Alignment.class, reader);
765     } //-- org.vamsas.objects.core.Alignment unmarshal(java.io.Reader) 
766
767     /**
768      * Method validate
769      * 
770      */
771     public void validate()
772         throws org.exolab.castor.xml.ValidationException
773     {
774         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
775         validator.validate(this);
776     } //-- void validate() 
777
778 }