default generation using sourcegen schema.
[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.9M1</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 _sequenceList
57      */
58     private java.util.Vector _sequenceList;
59
60     /**
61      * Field _sequenceSetAnnotationsList
62      */
63     private java.util.Vector _sequenceSetAnnotationsList;
64
65     /**
66      * Field _alignmentList
67      */
68     private java.util.Vector _alignmentList;
69
70     /**
71      * Field _tree
72      */
73     private org.vamsas.objects.core.Tree _tree;
74
75     /**
76      * Field _provenance
77      */
78     private org.vamsas.objects.core.Provenance _provenance;
79
80
81       //----------------/
82      //- Constructors -/
83     //----------------/
84
85     public SequenceSet() 
86      {
87         super();
88         _sequenceList = new Vector();
89         _sequenceSetAnnotationsList = new Vector();
90         _alignmentList = new Vector();
91     } //-- org.vamsas.objects.core.SequenceSet()
92
93
94       //-----------/
95      //- Methods -/
96     //-----------/
97
98     /**
99      * Method addAlignment
100      * 
101      * 
102      * 
103      * @param vAlignment
104      */
105     public void addAlignment(org.vamsas.objects.core.Alignment vAlignment)
106         throws java.lang.IndexOutOfBoundsException
107     {
108         _alignmentList.addElement(vAlignment);
109     } //-- void addAlignment(org.vamsas.objects.core.Alignment) 
110
111     /**
112      * Method addAlignment
113      * 
114      * 
115      * 
116      * @param index
117      * @param vAlignment
118      */
119     public void addAlignment(int index, org.vamsas.objects.core.Alignment vAlignment)
120         throws java.lang.IndexOutOfBoundsException
121     {
122         _alignmentList.insertElementAt(vAlignment, index);
123     } //-- void addAlignment(int, org.vamsas.objects.core.Alignment) 
124
125     /**
126      * Method addSequence
127      * 
128      * 
129      * 
130      * @param vSequence
131      */
132     public void addSequence(org.vamsas.objects.core.Sequence vSequence)
133         throws java.lang.IndexOutOfBoundsException
134     {
135         _sequenceList.addElement(vSequence);
136     } //-- void addSequence(org.vamsas.objects.core.Sequence) 
137
138     /**
139      * Method addSequence
140      * 
141      * 
142      * 
143      * @param index
144      * @param vSequence
145      */
146     public void addSequence(int index, org.vamsas.objects.core.Sequence vSequence)
147         throws java.lang.IndexOutOfBoundsException
148     {
149         _sequenceList.insertElementAt(vSequence, index);
150     } //-- void addSequence(int, org.vamsas.objects.core.Sequence) 
151
152     /**
153      * Method addSequenceSetAnnotations
154      * 
155      * 
156      * 
157      * @param vSequenceSetAnnotations
158      */
159     public void addSequenceSetAnnotations(org.vamsas.objects.core.SequenceSetAnnotations vSequenceSetAnnotations)
160         throws java.lang.IndexOutOfBoundsException
161     {
162         _sequenceSetAnnotationsList.addElement(vSequenceSetAnnotations);
163     } //-- void addSequenceSetAnnotations(org.vamsas.objects.core.SequenceSetAnnotations) 
164
165     /**
166      * Method addSequenceSetAnnotations
167      * 
168      * 
169      * 
170      * @param index
171      * @param vSequenceSetAnnotations
172      */
173     public void addSequenceSetAnnotations(int index, org.vamsas.objects.core.SequenceSetAnnotations vSequenceSetAnnotations)
174         throws java.lang.IndexOutOfBoundsException
175     {
176         _sequenceSetAnnotationsList.insertElementAt(vSequenceSetAnnotations, index);
177     } //-- void addSequenceSetAnnotations(int, org.vamsas.objects.core.SequenceSetAnnotations) 
178
179     /**
180      * Method deleteAligned
181      * 
182      */
183     public void deleteAligned()
184     {
185         this._has_aligned= false;
186     } //-- void deleteAligned() 
187
188     /**
189      * Method enumerateAlignment
190      * 
191      * 
192      * 
193      * @return Enumeration
194      */
195     public java.util.Enumeration enumerateAlignment()
196     {
197         return _alignmentList.elements();
198     } //-- java.util.Enumeration enumerateAlignment() 
199
200     /**
201      * Method enumerateSequence
202      * 
203      * 
204      * 
205      * @return Enumeration
206      */
207     public java.util.Enumeration enumerateSequence()
208     {
209         return _sequenceList.elements();
210     } //-- java.util.Enumeration enumerateSequence() 
211
212     /**
213      * Method enumerateSequenceSetAnnotations
214      * 
215      * 
216      * 
217      * @return Enumeration
218      */
219     public java.util.Enumeration enumerateSequenceSetAnnotations()
220     {
221         return _sequenceSetAnnotationsList.elements();
222     } //-- java.util.Enumeration enumerateSequenceSetAnnotations() 
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 SequenceSet) {
239         
240             SequenceSet temp = (SequenceSet)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._sequenceList != null) {
253                 if (temp._sequenceList == null) return false;
254                 else if (!(this._sequenceList.equals(temp._sequenceList))) 
255                     return false;
256             }
257             else if (temp._sequenceList != null)
258                 return false;
259             if (this._sequenceSetAnnotationsList != null) {
260                 if (temp._sequenceSetAnnotationsList == null) return false;
261                 else if (!(this._sequenceSetAnnotationsList.equals(temp._sequenceSetAnnotationsList))) 
262                     return false;
263             }
264             else if (temp._sequenceSetAnnotationsList != null)
265                 return false;
266             if (this._alignmentList != null) {
267                 if (temp._alignmentList == null) return false;
268                 else if (!(this._alignmentList.equals(temp._alignmentList))) 
269                     return false;
270             }
271             else if (temp._alignmentList != null)
272                 return false;
273             if (this._tree != null) {
274                 if (temp._tree == null) return false;
275                 else if (!(this._tree.equals(temp._tree))) 
276                     return false;
277             }
278             else if (temp._tree != 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 getAlignment
305      * 
306      * 
307      * 
308      * @param index
309      * @return Alignment
310      */
311     public org.vamsas.objects.core.Alignment getAlignment(int index)
312         throws java.lang.IndexOutOfBoundsException
313     {
314         //-- check bounds for index
315         if ((index < 0) || (index > _alignmentList.size())) {
316             throw new IndexOutOfBoundsException("getAlignment: Index value '"+index+"' not in range [0.."+_alignmentList.size()+ "]");
317         }
318         
319         return (org.vamsas.objects.core.Alignment) _alignmentList.elementAt(index);
320     } //-- org.vamsas.objects.core.Alignment getAlignment(int) 
321
322     /**
323      * Method getAlignment
324      * 
325      * 
326      * 
327      * @return Alignment
328      */
329     public org.vamsas.objects.core.Alignment[] getAlignment()
330     {
331         int size = _alignmentList.size();
332         org.vamsas.objects.core.Alignment[] mArray = new org.vamsas.objects.core.Alignment[size];
333         for (int index = 0; index < size; index++) {
334             mArray[index] = (org.vamsas.objects.core.Alignment) _alignmentList.elementAt(index);
335         }
336         return mArray;
337     } //-- org.vamsas.objects.core.Alignment[] getAlignment() 
338
339     /**
340      * Method getAlignmentCount
341      * 
342      * 
343      * 
344      * @return int
345      */
346     public int getAlignmentCount()
347     {
348         return _alignmentList.size();
349     } //-- int getAlignmentCount() 
350
351     /**
352      * Returns the value of field 'gapChar'.
353      * 
354      * @return String
355      * @return the value of field 'gapChar'.
356      */
357     public java.lang.String getGapChar()
358     {
359         return this._gapChar;
360     } //-- java.lang.String getGapChar() 
361
362     /**
363      * Returns the value of field 'provenance'.
364      * 
365      * @return Provenance
366      * @return the value of field 'provenance'.
367      */
368     public org.vamsas.objects.core.Provenance getProvenance()
369     {
370         return this._provenance;
371     } //-- org.vamsas.objects.core.Provenance getProvenance() 
372
373     /**
374      * Method getSequence
375      * 
376      * 
377      * 
378      * @param index
379      * @return Sequence
380      */
381     public org.vamsas.objects.core.Sequence getSequence(int index)
382         throws java.lang.IndexOutOfBoundsException
383     {
384         //-- check bounds for index
385         if ((index < 0) || (index > _sequenceList.size())) {
386             throw new IndexOutOfBoundsException("getSequence: Index value '"+index+"' not in range [0.."+_sequenceList.size()+ "]");
387         }
388         
389         return (org.vamsas.objects.core.Sequence) _sequenceList.elementAt(index);
390     } //-- org.vamsas.objects.core.Sequence getSequence(int) 
391
392     /**
393      * Method getSequence
394      * 
395      * 
396      * 
397      * @return Sequence
398      */
399     public org.vamsas.objects.core.Sequence[] getSequence()
400     {
401         int size = _sequenceList.size();
402         org.vamsas.objects.core.Sequence[] mArray = new org.vamsas.objects.core.Sequence[size];
403         for (int index = 0; index < size; index++) {
404             mArray[index] = (org.vamsas.objects.core.Sequence) _sequenceList.elementAt(index);
405         }
406         return mArray;
407     } //-- org.vamsas.objects.core.Sequence[] getSequence() 
408
409     /**
410      * Method getSequenceCount
411      * 
412      * 
413      * 
414      * @return int
415      */
416     public int getSequenceCount()
417     {
418         return _sequenceList.size();
419     } //-- int getSequenceCount() 
420
421     /**
422      * Method getSequenceSetAnnotations
423      * 
424      * 
425      * 
426      * @param index
427      * @return SequenceSetAnnotations
428      */
429     public org.vamsas.objects.core.SequenceSetAnnotations getSequenceSetAnnotations(int index)
430         throws java.lang.IndexOutOfBoundsException
431     {
432         //-- check bounds for index
433         if ((index < 0) || (index > _sequenceSetAnnotationsList.size())) {
434             throw new IndexOutOfBoundsException("getSequenceSetAnnotations: Index value '"+index+"' not in range [0.."+_sequenceSetAnnotationsList.size()+ "]");
435         }
436         
437         return (org.vamsas.objects.core.SequenceSetAnnotations) _sequenceSetAnnotationsList.elementAt(index);
438     } //-- org.vamsas.objects.core.SequenceSetAnnotations getSequenceSetAnnotations(int) 
439
440     /**
441      * Method getSequenceSetAnnotations
442      * 
443      * 
444      * 
445      * @return SequenceSetAnnotations
446      */
447     public org.vamsas.objects.core.SequenceSetAnnotations[] getSequenceSetAnnotations()
448     {
449         int size = _sequenceSetAnnotationsList.size();
450         org.vamsas.objects.core.SequenceSetAnnotations[] mArray = new org.vamsas.objects.core.SequenceSetAnnotations[size];
451         for (int index = 0; index < size; index++) {
452             mArray[index] = (org.vamsas.objects.core.SequenceSetAnnotations) _sequenceSetAnnotationsList.elementAt(index);
453         }
454         return mArray;
455     } //-- org.vamsas.objects.core.SequenceSetAnnotations[] getSequenceSetAnnotations() 
456
457     /**
458      * Method getSequenceSetAnnotationsCount
459      * 
460      * 
461      * 
462      * @return int
463      */
464     public int getSequenceSetAnnotationsCount()
465     {
466         return _sequenceSetAnnotationsList.size();
467     } //-- int getSequenceSetAnnotationsCount() 
468
469     /**
470      * Returns the value of field 'tree'.
471      * 
472      * @return Tree
473      * @return the value of field 'tree'.
474      */
475     public org.vamsas.objects.core.Tree getTree()
476     {
477         return this._tree;
478     } //-- org.vamsas.objects.core.Tree getTree() 
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 removeAlignment
540      * 
541      * 
542      * 
543      * @param index
544      * @return Alignment
545      */
546     public org.vamsas.objects.core.Alignment removeAlignment(int index)
547     {
548         java.lang.Object obj = _alignmentList.elementAt(index);
549         _alignmentList.removeElementAt(index);
550         return (org.vamsas.objects.core.Alignment) obj;
551     } //-- org.vamsas.objects.core.Alignment removeAlignment(int) 
552
553     /**
554      * Method removeAllAlignment
555      * 
556      */
557     public void removeAllAlignment()
558     {
559         _alignmentList.removeAllElements();
560     } //-- void removeAllAlignment() 
561
562     /**
563      * Method removeAllSequence
564      * 
565      */
566     public void removeAllSequence()
567     {
568         _sequenceList.removeAllElements();
569     } //-- void removeAllSequence() 
570
571     /**
572      * Method removeAllSequenceSetAnnotations
573      * 
574      */
575     public void removeAllSequenceSetAnnotations()
576     {
577         _sequenceSetAnnotationsList.removeAllElements();
578     } //-- void removeAllSequenceSetAnnotations() 
579
580     /**
581      * Method removeSequence
582      * 
583      * 
584      * 
585      * @param index
586      * @return Sequence
587      */
588     public org.vamsas.objects.core.Sequence removeSequence(int index)
589     {
590         java.lang.Object obj = _sequenceList.elementAt(index);
591         _sequenceList.removeElementAt(index);
592         return (org.vamsas.objects.core.Sequence) obj;
593     } //-- org.vamsas.objects.core.Sequence removeSequence(int) 
594
595     /**
596      * Method removeSequenceSetAnnotations
597      * 
598      * 
599      * 
600      * @param index
601      * @return SequenceSetAnnotations
602      */
603     public org.vamsas.objects.core.SequenceSetAnnotations removeSequenceSetAnnotations(int index)
604     {
605         java.lang.Object obj = _sequenceSetAnnotationsList.elementAt(index);
606         _sequenceSetAnnotationsList.removeElementAt(index);
607         return (org.vamsas.objects.core.SequenceSetAnnotations) obj;
608     } //-- org.vamsas.objects.core.SequenceSetAnnotations removeSequenceSetAnnotations(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 setAlignment
623      * 
624      * 
625      * 
626      * @param index
627      * @param vAlignment
628      */
629     public void setAlignment(int index, org.vamsas.objects.core.Alignment vAlignment)
630         throws java.lang.IndexOutOfBoundsException
631     {
632         //-- check bounds for index
633         if ((index < 0) || (index > _alignmentList.size())) {
634             throw new IndexOutOfBoundsException("setAlignment: Index value '"+index+"' not in range [0.."+_alignmentList.size()+ "]");
635         }
636         _alignmentList.setElementAt(vAlignment, index);
637     } //-- void setAlignment(int, org.vamsas.objects.core.Alignment) 
638
639     /**
640      * Method setAlignment
641      * 
642      * 
643      * 
644      * @param alignmentArray
645      */
646     public void setAlignment(org.vamsas.objects.core.Alignment[] alignmentArray)
647     {
648         //-- copy array
649         _alignmentList.removeAllElements();
650         for (int i = 0; i < alignmentArray.length; i++) {
651             _alignmentList.addElement(alignmentArray[i]);
652         }
653     } //-- void setAlignment(org.vamsas.objects.core.Alignment) 
654
655     /**
656      * Sets the value of field 'gapChar'.
657      * 
658      * @param gapChar the value of field 'gapChar'.
659      */
660     public void setGapChar(java.lang.String gapChar)
661     {
662         this._gapChar = gapChar;
663     } //-- void setGapChar(java.lang.String) 
664
665     /**
666      * Sets the value of field 'provenance'.
667      * 
668      * @param provenance the value of field 'provenance'.
669      */
670     public void setProvenance(org.vamsas.objects.core.Provenance provenance)
671     {
672         this._provenance = provenance;
673     } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
674
675     /**
676      * Method setSequence
677      * 
678      * 
679      * 
680      * @param index
681      * @param vSequence
682      */
683     public void setSequence(int index, org.vamsas.objects.core.Sequence vSequence)
684         throws java.lang.IndexOutOfBoundsException
685     {
686         //-- check bounds for index
687         if ((index < 0) || (index > _sequenceList.size())) {
688             throw new IndexOutOfBoundsException("setSequence: Index value '"+index+"' not in range [0.."+_sequenceList.size()+ "]");
689         }
690         _sequenceList.setElementAt(vSequence, index);
691     } //-- void setSequence(int, org.vamsas.objects.core.Sequence) 
692
693     /**
694      * Method setSequence
695      * 
696      * 
697      * 
698      * @param sequenceArray
699      */
700     public void setSequence(org.vamsas.objects.core.Sequence[] sequenceArray)
701     {
702         //-- copy array
703         _sequenceList.removeAllElements();
704         for (int i = 0; i < sequenceArray.length; i++) {
705             _sequenceList.addElement(sequenceArray[i]);
706         }
707     } //-- void setSequence(org.vamsas.objects.core.Sequence) 
708
709     /**
710      * Method setSequenceSetAnnotations
711      * 
712      * 
713      * 
714      * @param index
715      * @param vSequenceSetAnnotations
716      */
717     public void setSequenceSetAnnotations(int index, org.vamsas.objects.core.SequenceSetAnnotations vSequenceSetAnnotations)
718         throws java.lang.IndexOutOfBoundsException
719     {
720         //-- check bounds for index
721         if ((index < 0) || (index > _sequenceSetAnnotationsList.size())) {
722             throw new IndexOutOfBoundsException("setSequenceSetAnnotations: Index value '"+index+"' not in range [0.."+_sequenceSetAnnotationsList.size()+ "]");
723         }
724         _sequenceSetAnnotationsList.setElementAt(vSequenceSetAnnotations, index);
725     } //-- void setSequenceSetAnnotations(int, org.vamsas.objects.core.SequenceSetAnnotations) 
726
727     /**
728      * Method setSequenceSetAnnotations
729      * 
730      * 
731      * 
732      * @param sequenceSetAnnotationsArray
733      */
734     public void setSequenceSetAnnotations(org.vamsas.objects.core.SequenceSetAnnotations[] sequenceSetAnnotationsArray)
735     {
736         //-- copy array
737         _sequenceSetAnnotationsList.removeAllElements();
738         for (int i = 0; i < sequenceSetAnnotationsArray.length; i++) {
739             _sequenceSetAnnotationsList.addElement(sequenceSetAnnotationsArray[i]);
740         }
741     } //-- void setSequenceSetAnnotations(org.vamsas.objects.core.SequenceSetAnnotations) 
742
743     /**
744      * Sets the value of field 'tree'.
745      * 
746      * @param tree the value of field 'tree'.
747      */
748     public void setTree(org.vamsas.objects.core.Tree tree)
749     {
750         this._tree = tree;
751     } //-- void setTree(org.vamsas.objects.core.Tree) 
752
753     /**
754      * Method unmarshal
755      * 
756      * 
757      * 
758      * @param reader
759      * @return SequenceSet
760      */
761     public static org.vamsas.objects.core.SequenceSet unmarshal(java.io.Reader reader)
762         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
763     {
764         return (org.vamsas.objects.core.SequenceSet) Unmarshaller.unmarshal(org.vamsas.objects.core.SequenceSet.class, reader);
765     } //-- org.vamsas.objects.core.SequenceSet 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 }