made vamsas a proper root element in schema and added example document.
[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 _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 _alignmentAnnotations
62      */
63     private org.vamsas.objects.core.AlignmentAnnotations _alignmentAnnotations;
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         _treeList = new Vector();
89         _alignmentSequenceList = new Vector();
90     } //-- org.vamsas.objects.core.Alignment()
91
92
93       //-----------/
94      //- Methods -/
95     //-----------/
96
97     /**
98      * Method addAlignmentSequence
99      * 
100      * 
101      * 
102      * @param vAlignmentSequence
103      */
104     public void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
105         throws java.lang.IndexOutOfBoundsException
106     {
107         _alignmentSequenceList.addElement(vAlignmentSequence);
108     } //-- void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
109
110     /**
111      * Method addAlignmentSequence
112      * 
113      * 
114      * 
115      * @param index
116      * @param vAlignmentSequence
117      */
118     public void addAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
119         throws java.lang.IndexOutOfBoundsException
120     {
121         _alignmentSequenceList.insertElementAt(vAlignmentSequence, index);
122     } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
123
124     /**
125      * Method addTree
126      * 
127      * 
128      * 
129      * @param vTree
130      */
131     public void addTree(org.vamsas.objects.core.Tree vTree)
132         throws java.lang.IndexOutOfBoundsException
133     {
134         _treeList.addElement(vTree);
135     } //-- void addTree(org.vamsas.objects.core.Tree) 
136
137     /**
138      * Method addTree
139      * 
140      * 
141      * 
142      * @param index
143      * @param vTree
144      */
145     public void addTree(int index, org.vamsas.objects.core.Tree vTree)
146         throws java.lang.IndexOutOfBoundsException
147     {
148         _treeList.insertElementAt(vTree, index);
149     } //-- void addTree(int, org.vamsas.objects.core.Tree) 
150
151     /**
152      * Method deleteAligned
153      * 
154      */
155     public void deleteAligned()
156     {
157         this._has_aligned= false;
158     } //-- void deleteAligned() 
159
160     /**
161      * Method enumerateAlignmentSequence
162      * 
163      * 
164      * 
165      * @return Enumeration
166      */
167     public java.util.Enumeration enumerateAlignmentSequence()
168     {
169         return _alignmentSequenceList.elements();
170     } //-- java.util.Enumeration enumerateAlignmentSequence() 
171
172     /**
173      * Method enumerateTree
174      * 
175      * 
176      * 
177      * @return Enumeration
178      */
179     public java.util.Enumeration enumerateTree()
180     {
181         return _treeList.elements();
182     } //-- java.util.Enumeration enumerateTree() 
183
184     /**
185      * Note: hashCode() has not been overriden
186      * 
187      * @param obj
188      * @return boolean
189      */
190     public boolean equals(java.lang.Object obj)
191     {
192         if ( this == obj )
193             return true;
194         
195         if (super.equals(obj)==false)
196             return false;
197         
198         if (obj instanceof Alignment) {
199         
200             Alignment temp = (Alignment)obj;
201             if (this._gapChar != null) {
202                 if (temp._gapChar == null) return false;
203                 else if (!(this._gapChar.equals(temp._gapChar))) 
204                     return false;
205             }
206             else if (temp._gapChar != null)
207                 return false;
208             if (this._aligned != temp._aligned)
209                 return false;
210             if (this._has_aligned != temp._has_aligned)
211                 return false;
212             if (this._id != null) {
213                 if (temp._id == null) return false;
214                 else if (!(this._id.equals(temp._id))) 
215                     return false;
216             }
217             else if (temp._id != null)
218                 return false;
219             if (this._alignmentAnnotations != null) {
220                 if (temp._alignmentAnnotations == null) return false;
221                 else if (!(this._alignmentAnnotations.equals(temp._alignmentAnnotations))) 
222                     return false;
223             }
224             else if (temp._alignmentAnnotations != null)
225                 return false;
226             if (this._treeList != null) {
227                 if (temp._treeList == null) return false;
228                 else if (!(this._treeList.equals(temp._treeList))) 
229                     return false;
230             }
231             else if (temp._treeList != null)
232                 return false;
233             if (this._alignmentSequenceList != null) {
234                 if (temp._alignmentSequenceList == null) return false;
235                 else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList))) 
236                     return false;
237             }
238             else if (temp._alignmentSequenceList != null)
239                 return false;
240             if (this._provenance != null) {
241                 if (temp._provenance == null) return false;
242                 else if (!(this._provenance.equals(temp._provenance))) 
243                     return false;
244             }
245             else if (temp._provenance != null)
246                 return false;
247             return true;
248         }
249         return false;
250     } //-- boolean equals(java.lang.Object) 
251
252     /**
253      * Returns the value of field 'aligned'.
254      * 
255      * @return boolean
256      * @return the value of field 'aligned'.
257      */
258     public boolean getAligned()
259     {
260         return this._aligned;
261     } //-- boolean getAligned() 
262
263     /**
264      * Returns the value of field 'alignmentAnnotations'.
265      * 
266      * @return AlignmentAnnotations
267      * @return the value of field 'alignmentAnnotations'.
268      */
269     public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations()
270     {
271         return this._alignmentAnnotations;
272     } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() 
273
274     /**
275      * Method getAlignmentSequence
276      * 
277      * 
278      * 
279      * @param index
280      * @return AlignmentSequence
281      */
282     public org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index)
283         throws java.lang.IndexOutOfBoundsException
284     {
285         //-- check bounds for index
286         if ((index < 0) || (index > _alignmentSequenceList.size())) {
287             throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
288         }
289         
290         return (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
291     } //-- org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int) 
292
293     /**
294      * Method getAlignmentSequence
295      * 
296      * 
297      * 
298      * @return AlignmentSequence
299      */
300     public org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
301     {
302         int size = _alignmentSequenceList.size();
303         org.vamsas.objects.core.AlignmentSequence[] mArray = new org.vamsas.objects.core.AlignmentSequence[size];
304         for (int index = 0; index < size; index++) {
305             mArray[index] = (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
306         }
307         return mArray;
308     } //-- org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() 
309
310     /**
311      * Method getAlignmentSequenceCount
312      * 
313      * 
314      * 
315      * @return int
316      */
317     public int getAlignmentSequenceCount()
318     {
319         return _alignmentSequenceList.size();
320     } //-- int getAlignmentSequenceCount() 
321
322     /**
323      * Returns the value of field 'gapChar'.
324      * 
325      * @return String
326      * @return the value of field 'gapChar'.
327      */
328     public java.lang.String getGapChar()
329     {
330         return this._gapChar;
331     } //-- java.lang.String getGapChar() 
332
333     /**
334      * Returns the value of field 'id'.
335      * 
336      * @return String
337      * @return the value of field 'id'.
338      */
339     public java.lang.String getId()
340     {
341         return this._id;
342     } //-- java.lang.String getId() 
343
344     /**
345      * Returns the value of field 'provenance'.
346      * 
347      * @return Provenance
348      * @return the value of field 'provenance'.
349      */
350     public org.vamsas.objects.core.Provenance getProvenance()
351     {
352         return this._provenance;
353     } //-- org.vamsas.objects.core.Provenance getProvenance() 
354
355     /**
356      * Method getTree
357      * 
358      * 
359      * 
360      * @param index
361      * @return Tree
362      */
363     public org.vamsas.objects.core.Tree getTree(int index)
364         throws java.lang.IndexOutOfBoundsException
365     {
366         //-- check bounds for index
367         if ((index < 0) || (index > _treeList.size())) {
368             throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
369         }
370         
371         return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
372     } //-- org.vamsas.objects.core.Tree getTree(int) 
373
374     /**
375      * Method getTree
376      * 
377      * 
378      * 
379      * @return Tree
380      */
381     public org.vamsas.objects.core.Tree[] getTree()
382     {
383         int size = _treeList.size();
384         org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
385         for (int index = 0; index < size; index++) {
386             mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
387         }
388         return mArray;
389     } //-- org.vamsas.objects.core.Tree[] getTree() 
390
391     /**
392      * Method getTreeCount
393      * 
394      * 
395      * 
396      * @return int
397      */
398     public int getTreeCount()
399     {
400         return _treeList.size();
401     } //-- int getTreeCount() 
402
403     /**
404      * Method hasAligned
405      * 
406      * 
407      * 
408      * @return boolean
409      */
410     public boolean hasAligned()
411     {
412         return this._has_aligned;
413     } //-- boolean hasAligned() 
414
415     /**
416      * Method isValid
417      * 
418      * 
419      * 
420      * @return boolean
421      */
422     public boolean isValid()
423     {
424         try {
425             validate();
426         }
427         catch (org.exolab.castor.xml.ValidationException vex) {
428             return false;
429         }
430         return true;
431     } //-- boolean isValid() 
432
433     /**
434      * Method marshal
435      * 
436      * 
437      * 
438      * @param out
439      */
440     public void marshal(java.io.Writer out)
441         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
442     {
443         
444         Marshaller.marshal(this, out);
445     } //-- void marshal(java.io.Writer) 
446
447     /**
448      * Method marshal
449      * 
450      * 
451      * 
452      * @param handler
453      */
454     public void marshal(org.xml.sax.ContentHandler handler)
455         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
456     {
457         
458         Marshaller.marshal(this, handler);
459     } //-- void marshal(org.xml.sax.ContentHandler) 
460
461     /**
462      * Method removeAlignmentSequence
463      * 
464      * 
465      * 
466      * @param index
467      * @return AlignmentSequence
468      */
469     public org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index)
470     {
471         java.lang.Object obj = _alignmentSequenceList.elementAt(index);
472         _alignmentSequenceList.removeElementAt(index);
473         return (org.vamsas.objects.core.AlignmentSequence) obj;
474     } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) 
475
476     /**
477      * Method removeAllAlignmentSequence
478      * 
479      */
480     public void removeAllAlignmentSequence()
481     {
482         _alignmentSequenceList.removeAllElements();
483     } //-- void removeAllAlignmentSequence() 
484
485     /**
486      * Method removeAllTree
487      * 
488      */
489     public void removeAllTree()
490     {
491         _treeList.removeAllElements();
492     } //-- void removeAllTree() 
493
494     /**
495      * Method removeTree
496      * 
497      * 
498      * 
499      * @param index
500      * @return Tree
501      */
502     public org.vamsas.objects.core.Tree removeTree(int index)
503     {
504         java.lang.Object obj = _treeList.elementAt(index);
505         _treeList.removeElementAt(index);
506         return (org.vamsas.objects.core.Tree) obj;
507     } //-- org.vamsas.objects.core.Tree removeTree(int) 
508
509     /**
510      * Sets the value of field 'aligned'.
511      * 
512      * @param aligned the value of field 'aligned'.
513      */
514     public void setAligned(boolean aligned)
515     {
516         this._aligned = aligned;
517         this._has_aligned = true;
518     } //-- void setAligned(boolean) 
519
520     /**
521      * Sets the value of field 'alignmentAnnotations'.
522      * 
523      * @param alignmentAnnotations the value of field
524      * 'alignmentAnnotations'.
525      */
526     public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations alignmentAnnotations)
527     {
528         this._alignmentAnnotations = alignmentAnnotations;
529     } //-- void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) 
530
531     /**
532      * Method setAlignmentSequence
533      * 
534      * 
535      * 
536      * @param index
537      * @param vAlignmentSequence
538      */
539     public void setAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
540         throws java.lang.IndexOutOfBoundsException
541     {
542         //-- check bounds for index
543         if ((index < 0) || (index > _alignmentSequenceList.size())) {
544             throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
545         }
546         _alignmentSequenceList.setElementAt(vAlignmentSequence, index);
547     } //-- void setAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
548
549     /**
550      * Method setAlignmentSequence
551      * 
552      * 
553      * 
554      * @param alignmentSequenceArray
555      */
556     public void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray)
557     {
558         //-- copy array
559         _alignmentSequenceList.removeAllElements();
560         for (int i = 0; i < alignmentSequenceArray.length; i++) {
561             _alignmentSequenceList.addElement(alignmentSequenceArray[i]);
562         }
563     } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
564
565     /**
566      * Sets the value of field 'gapChar'.
567      * 
568      * @param gapChar the value of field 'gapChar'.
569      */
570     public void setGapChar(java.lang.String gapChar)
571     {
572         this._gapChar = gapChar;
573     } //-- void setGapChar(java.lang.String) 
574
575     /**
576      * Sets the value of field 'id'.
577      * 
578      * @param id the value of field 'id'.
579      */
580     public void setId(java.lang.String id)
581     {
582         this._id = id;
583     } //-- void setId(java.lang.String) 
584
585     /**
586      * Sets the value of field 'provenance'.
587      * 
588      * @param provenance the value of field 'provenance'.
589      */
590     public void setProvenance(org.vamsas.objects.core.Provenance provenance)
591     {
592         this._provenance = provenance;
593     } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
594
595     /**
596      * Method setTree
597      * 
598      * 
599      * 
600      * @param index
601      * @param vTree
602      */
603     public void setTree(int index, org.vamsas.objects.core.Tree vTree)
604         throws java.lang.IndexOutOfBoundsException
605     {
606         //-- check bounds for index
607         if ((index < 0) || (index > _treeList.size())) {
608             throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
609         }
610         _treeList.setElementAt(vTree, index);
611     } //-- void setTree(int, org.vamsas.objects.core.Tree) 
612
613     /**
614      * Method setTree
615      * 
616      * 
617      * 
618      * @param treeArray
619      */
620     public void setTree(org.vamsas.objects.core.Tree[] treeArray)
621     {
622         //-- copy array
623         _treeList.removeAllElements();
624         for (int i = 0; i < treeArray.length; i++) {
625             _treeList.addElement(treeArray[i]);
626         }
627     } //-- void setTree(org.vamsas.objects.core.Tree) 
628
629     /**
630      * Method unmarshal
631      * 
632      * 
633      * 
634      * @param reader
635      * @return Alignment
636      */
637     public static org.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader)
638         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
639     {
640         return (org.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(org.vamsas.objects.core.Alignment.class, reader);
641     } //-- org.vamsas.objects.core.Alignment unmarshal(java.io.Reader) 
642
643     /**
644      * Method validate
645      * 
646      */
647     public void validate()
648         throws org.exolab.castor.xml.ValidationException
649     {
650         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
651         validator.validate(this);
652     } //-- void validate() 
653
654 }