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