2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package org.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
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;
29 * @version $Revision$ $Date$
31 public class Alignment extends org.vamsas.client.Vobject
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
43 private java.lang.String _gapChar;
48 private boolean _aligned;
51 * keeps track of state for field: _aligned
53 private boolean _has_aligned;
56 * Primary Key for vamsas object
60 private java.lang.String _id;
63 * objects with modifiable=false will
64 * not be modified by a vamsas client
68 private boolean _modifiable = true;
71 * keeps track of state for field: _modifiable
73 private boolean _has_modifiable;
76 * This is annotation over the
77 * coordinate frame defined by all
78 * the columns in the alignment.
81 private java.util.Vector _alignmentAnnotationList;
86 private java.util.Vector _treeList;
89 * Field _alignmentSequenceList
91 private java.util.Vector _alignmentSequenceList;
94 * typical properties may be
95 * additional alignment score
99 private java.util.Vector _propertyList;
104 private org.vamsas.objects.core.Provenance _provenance;
114 _alignmentAnnotationList = new Vector();
115 _treeList = new Vector();
116 _alignmentSequenceList = new Vector();
117 _propertyList = new Vector();
118 } //-- org.vamsas.objects.core.Alignment()
126 * Method addAlignmentAnnotation
130 * @param vAlignmentAnnotation
132 public void addAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
133 throws java.lang.IndexOutOfBoundsException
135 _alignmentAnnotationList.addElement(vAlignmentAnnotation);
136 } //-- void addAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation)
139 * Method addAlignmentAnnotation
144 * @param vAlignmentAnnotation
146 public void addAlignmentAnnotation(int index, org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
147 throws java.lang.IndexOutOfBoundsException
149 _alignmentAnnotationList.insertElementAt(vAlignmentAnnotation, index);
150 } //-- void addAlignmentAnnotation(int, org.vamsas.objects.core.AlignmentAnnotation)
153 * Method addAlignmentSequence
157 * @param vAlignmentSequence
159 public void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
160 throws java.lang.IndexOutOfBoundsException
162 _alignmentSequenceList.addElement(vAlignmentSequence);
163 } //-- void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence)
166 * Method addAlignmentSequence
171 * @param vAlignmentSequence
173 public void addAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
174 throws java.lang.IndexOutOfBoundsException
176 _alignmentSequenceList.insertElementAt(vAlignmentSequence, index);
177 } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence)
186 public void addProperty(org.vamsas.objects.core.Property vProperty)
187 throws java.lang.IndexOutOfBoundsException
189 _propertyList.addElement(vProperty);
190 } //-- void addProperty(org.vamsas.objects.core.Property)
200 public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
201 throws java.lang.IndexOutOfBoundsException
203 _propertyList.insertElementAt(vProperty, index);
204 } //-- void addProperty(int, org.vamsas.objects.core.Property)
213 public void addTree(org.vamsas.objects.core.Tree vTree)
214 throws java.lang.IndexOutOfBoundsException
216 _treeList.addElement(vTree);
217 } //-- void addTree(org.vamsas.objects.core.Tree)
227 public void addTree(int index, org.vamsas.objects.core.Tree vTree)
228 throws java.lang.IndexOutOfBoundsException
230 _treeList.insertElementAt(vTree, index);
231 } //-- void addTree(int, org.vamsas.objects.core.Tree)
234 * Method deleteAligned
237 public void deleteAligned()
239 this._has_aligned= false;
240 } //-- void deleteAligned()
243 * Method deleteModifiable
246 public void deleteModifiable()
248 this._has_modifiable= false;
249 } //-- void deleteModifiable()
252 * Method enumerateAlignmentAnnotation
256 * @return Enumeration
258 public java.util.Enumeration enumerateAlignmentAnnotation()
260 return _alignmentAnnotationList.elements();
261 } //-- java.util.Enumeration enumerateAlignmentAnnotation()
264 * Method enumerateAlignmentSequence
268 * @return Enumeration
270 public java.util.Enumeration enumerateAlignmentSequence()
272 return _alignmentSequenceList.elements();
273 } //-- java.util.Enumeration enumerateAlignmentSequence()
276 * Method enumerateProperty
280 * @return Enumeration
282 public java.util.Enumeration enumerateProperty()
284 return _propertyList.elements();
285 } //-- java.util.Enumeration enumerateProperty()
288 * Method enumerateTree
292 * @return Enumeration
294 public java.util.Enumeration enumerateTree()
296 return _treeList.elements();
297 } //-- java.util.Enumeration enumerateTree()
300 * Note: hashCode() has not been overriden
305 public boolean equals(java.lang.Object obj)
310 if (super.equals(obj)==false)
313 if (obj instanceof Alignment) {
315 Alignment temp = (Alignment)obj;
316 if (this._gapChar != null) {
317 if (temp._gapChar == null) return false;
318 else if (!(this._gapChar.equals(temp._gapChar)))
321 else if (temp._gapChar != null)
323 if (this._aligned != temp._aligned)
325 if (this._has_aligned != temp._has_aligned)
327 if (this._id != null) {
328 if (temp._id == null) return false;
329 else if (!(this._id.equals(temp._id)))
332 else if (temp._id != null)
334 if (this._modifiable != temp._modifiable)
336 if (this._has_modifiable != temp._has_modifiable)
338 if (this._alignmentAnnotationList != null) {
339 if (temp._alignmentAnnotationList == null) return false;
340 else if (!(this._alignmentAnnotationList.equals(temp._alignmentAnnotationList)))
343 else if (temp._alignmentAnnotationList != null)
345 if (this._treeList != null) {
346 if (temp._treeList == null) return false;
347 else if (!(this._treeList.equals(temp._treeList)))
350 else if (temp._treeList != null)
352 if (this._alignmentSequenceList != null) {
353 if (temp._alignmentSequenceList == null) return false;
354 else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList)))
357 else if (temp._alignmentSequenceList != null)
359 if (this._propertyList != null) {
360 if (temp._propertyList == null) return false;
361 else if (!(this._propertyList.equals(temp._propertyList)))
364 else if (temp._propertyList != null)
366 if (this._provenance != null) {
367 if (temp._provenance == null) return false;
368 else if (!(this._provenance.equals(temp._provenance)))
371 else if (temp._provenance != null)
376 } //-- boolean equals(java.lang.Object)
379 * Returns the value of field 'aligned'.
382 * @return the value of field 'aligned'.
384 public boolean getAligned()
386 return this._aligned;
387 } //-- boolean getAligned()
390 * Method getAlignmentAnnotation
395 * @return AlignmentAnnotation
397 public org.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int index)
398 throws java.lang.IndexOutOfBoundsException
400 //-- check bounds for index
401 if ((index < 0) || (index > _alignmentAnnotationList.size())) {
402 throw new IndexOutOfBoundsException("getAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
405 return (org.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
406 } //-- org.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int)
409 * Method getAlignmentAnnotation
413 * @return AlignmentAnnotation
415 public org.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation()
417 int size = _alignmentAnnotationList.size();
418 org.vamsas.objects.core.AlignmentAnnotation[] mArray = new org.vamsas.objects.core.AlignmentAnnotation[size];
419 for (int index = 0; index < size; index++) {
420 mArray[index] = (org.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
423 } //-- org.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation()
426 * Method getAlignmentAnnotationCount
432 public int getAlignmentAnnotationCount()
434 return _alignmentAnnotationList.size();
435 } //-- int getAlignmentAnnotationCount()
438 * Method getAlignmentSequence
443 * @return AlignmentSequence
445 public org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index)
446 throws java.lang.IndexOutOfBoundsException
448 //-- check bounds for index
449 if ((index < 0) || (index > _alignmentSequenceList.size())) {
450 throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
453 return (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
454 } //-- org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int)
457 * Method getAlignmentSequence
461 * @return AlignmentSequence
463 public org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
465 int size = _alignmentSequenceList.size();
466 org.vamsas.objects.core.AlignmentSequence[] mArray = new org.vamsas.objects.core.AlignmentSequence[size];
467 for (int index = 0; index < size; index++) {
468 mArray[index] = (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
471 } //-- org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
474 * Method getAlignmentSequenceCount
480 public int getAlignmentSequenceCount()
482 return _alignmentSequenceList.size();
483 } //-- int getAlignmentSequenceCount()
486 * Returns the value of field 'gapChar'.
489 * @return the value of field 'gapChar'.
491 public java.lang.String getGapChar()
493 return this._gapChar;
494 } //-- java.lang.String getGapChar()
497 * Returns the value of field 'id'. The field 'id' has the
498 * following description: Primary Key for vamsas object
503 * @return the value of field 'id'.
505 public java.lang.String getId()
508 } //-- java.lang.String getId()
511 * Returns the value of field 'modifiable'. The field
512 * 'modifiable' has the following description: objects with
513 * modifiable=false will
514 * not be modified by a vamsas client
519 * @return the value of field 'modifiable'.
521 public boolean getModifiable()
523 return this._modifiable;
524 } //-- boolean getModifiable()
534 public org.vamsas.objects.core.Property getProperty(int index)
535 throws java.lang.IndexOutOfBoundsException
537 //-- check bounds for index
538 if ((index < 0) || (index > _propertyList.size())) {
539 throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
542 return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
543 } //-- org.vamsas.objects.core.Property getProperty(int)
552 public org.vamsas.objects.core.Property[] getProperty()
554 int size = _propertyList.size();
555 org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
556 for (int index = 0; index < size; index++) {
557 mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
560 } //-- org.vamsas.objects.core.Property[] getProperty()
563 * Method getPropertyCount
569 public int getPropertyCount()
571 return _propertyList.size();
572 } //-- int getPropertyCount()
575 * Returns the value of field 'provenance'.
578 * @return the value of field 'provenance'.
580 public org.vamsas.objects.core.Provenance getProvenance()
582 return this._provenance;
583 } //-- org.vamsas.objects.core.Provenance getProvenance()
593 public org.vamsas.objects.core.Tree getTree(int index)
594 throws java.lang.IndexOutOfBoundsException
596 //-- check bounds for index
597 if ((index < 0) || (index > _treeList.size())) {
598 throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
601 return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
602 } //-- org.vamsas.objects.core.Tree getTree(int)
611 public org.vamsas.objects.core.Tree[] getTree()
613 int size = _treeList.size();
614 org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
615 for (int index = 0; index < size; index++) {
616 mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
619 } //-- org.vamsas.objects.core.Tree[] getTree()
622 * Method getTreeCount
628 public int getTreeCount()
630 return _treeList.size();
631 } //-- int getTreeCount()
640 public boolean hasAligned()
642 return this._has_aligned;
643 } //-- boolean hasAligned()
646 * Method hasModifiable
652 public boolean hasModifiable()
654 return this._has_modifiable;
655 } //-- boolean hasModifiable()
664 public boolean isValid()
669 catch (org.exolab.castor.xml.ValidationException vex) {
673 } //-- boolean isValid()
682 public void marshal(java.io.Writer out)
683 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
686 Marshaller.marshal(this, out);
687 } //-- void marshal(java.io.Writer)
696 public void marshal(org.xml.sax.ContentHandler handler)
697 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
700 Marshaller.marshal(this, handler);
701 } //-- void marshal(org.xml.sax.ContentHandler)
704 * Method removeAlignmentAnnotation
709 * @return AlignmentAnnotation
711 public org.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int index)
713 java.lang.Object obj = _alignmentAnnotationList.elementAt(index);
714 _alignmentAnnotationList.removeElementAt(index);
715 return (org.vamsas.objects.core.AlignmentAnnotation) obj;
716 } //-- org.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int)
719 * Method removeAlignmentSequence
724 * @return AlignmentSequence
726 public org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index)
728 java.lang.Object obj = _alignmentSequenceList.elementAt(index);
729 _alignmentSequenceList.removeElementAt(index);
730 return (org.vamsas.objects.core.AlignmentSequence) obj;
731 } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int)
734 * Method removeAllAlignmentAnnotation
737 public void removeAllAlignmentAnnotation()
739 _alignmentAnnotationList.removeAllElements();
740 } //-- void removeAllAlignmentAnnotation()
743 * Method removeAllAlignmentSequence
746 public void removeAllAlignmentSequence()
748 _alignmentSequenceList.removeAllElements();
749 } //-- void removeAllAlignmentSequence()
752 * Method removeAllProperty
755 public void removeAllProperty()
757 _propertyList.removeAllElements();
758 } //-- void removeAllProperty()
761 * Method removeAllTree
764 public void removeAllTree()
766 _treeList.removeAllElements();
767 } //-- void removeAllTree()
770 * Method removeProperty
777 public org.vamsas.objects.core.Property removeProperty(int index)
779 java.lang.Object obj = _propertyList.elementAt(index);
780 _propertyList.removeElementAt(index);
781 return (org.vamsas.objects.core.Property) obj;
782 } //-- org.vamsas.objects.core.Property removeProperty(int)
792 public org.vamsas.objects.core.Tree removeTree(int index)
794 java.lang.Object obj = _treeList.elementAt(index);
795 _treeList.removeElementAt(index);
796 return (org.vamsas.objects.core.Tree) obj;
797 } //-- org.vamsas.objects.core.Tree removeTree(int)
800 * Sets the value of field 'aligned'.
802 * @param aligned the value of field 'aligned'.
804 public void setAligned(boolean aligned)
806 this._aligned = aligned;
807 this._has_aligned = true;
808 } //-- void setAligned(boolean)
811 * Method setAlignmentAnnotation
816 * @param vAlignmentAnnotation
818 public void setAlignmentAnnotation(int index, org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
819 throws java.lang.IndexOutOfBoundsException
821 //-- check bounds for index
822 if ((index < 0) || (index > _alignmentAnnotationList.size())) {
823 throw new IndexOutOfBoundsException("setAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
825 _alignmentAnnotationList.setElementAt(vAlignmentAnnotation, index);
826 } //-- void setAlignmentAnnotation(int, org.vamsas.objects.core.AlignmentAnnotation)
829 * Method setAlignmentAnnotation
833 * @param alignmentAnnotationArray
835 public void setAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation[] alignmentAnnotationArray)
838 _alignmentAnnotationList.removeAllElements();
839 for (int i = 0; i < alignmentAnnotationArray.length; i++) {
840 _alignmentAnnotationList.addElement(alignmentAnnotationArray[i]);
842 } //-- void setAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation)
845 * Method setAlignmentSequence
850 * @param vAlignmentSequence
852 public void setAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
853 throws java.lang.IndexOutOfBoundsException
855 //-- check bounds for index
856 if ((index < 0) || (index > _alignmentSequenceList.size())) {
857 throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
859 _alignmentSequenceList.setElementAt(vAlignmentSequence, index);
860 } //-- void setAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence)
863 * Method setAlignmentSequence
867 * @param alignmentSequenceArray
869 public void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray)
872 _alignmentSequenceList.removeAllElements();
873 for (int i = 0; i < alignmentSequenceArray.length; i++) {
874 _alignmentSequenceList.addElement(alignmentSequenceArray[i]);
876 } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence)
879 * Sets the value of field 'gapChar'.
881 * @param gapChar the value of field 'gapChar'.
883 public void setGapChar(java.lang.String gapChar)
885 this._gapChar = gapChar;
886 } //-- void setGapChar(java.lang.String)
889 * Sets the value of field 'id'. The field 'id' has the
890 * following description: Primary Key for vamsas object
894 * @param id the value of field 'id'.
896 public void setId(java.lang.String id)
899 } //-- void setId(java.lang.String)
902 * Sets the value of field 'modifiable'. The field 'modifiable'
903 * has the following description: objects with modifiable=false
905 * not be modified by a vamsas client
909 * @param modifiable the value of field 'modifiable'.
911 public void setModifiable(boolean modifiable)
913 this._modifiable = modifiable;
914 this._has_modifiable = true;
915 } //-- void setModifiable(boolean)
925 public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
926 throws java.lang.IndexOutOfBoundsException
928 //-- check bounds for index
929 if ((index < 0) || (index > _propertyList.size())) {
930 throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
932 _propertyList.setElementAt(vProperty, index);
933 } //-- void setProperty(int, org.vamsas.objects.core.Property)
940 * @param propertyArray
942 public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
945 _propertyList.removeAllElements();
946 for (int i = 0; i < propertyArray.length; i++) {
947 _propertyList.addElement(propertyArray[i]);
949 } //-- void setProperty(org.vamsas.objects.core.Property)
952 * Sets the value of field 'provenance'.
954 * @param provenance the value of field 'provenance'.
956 public void setProvenance(org.vamsas.objects.core.Provenance provenance)
958 this._provenance = provenance;
959 } //-- void setProvenance(org.vamsas.objects.core.Provenance)
969 public void setTree(int index, org.vamsas.objects.core.Tree vTree)
970 throws java.lang.IndexOutOfBoundsException
972 //-- check bounds for index
973 if ((index < 0) || (index > _treeList.size())) {
974 throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
976 _treeList.setElementAt(vTree, index);
977 } //-- void setTree(int, org.vamsas.objects.core.Tree)
986 public void setTree(org.vamsas.objects.core.Tree[] treeArray)
989 _treeList.removeAllElements();
990 for (int i = 0; i < treeArray.length; i++) {
991 _treeList.addElement(treeArray[i]);
993 } //-- void setTree(org.vamsas.objects.core.Tree)
1003 public static org.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader)
1004 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
1006 return (org.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(org.vamsas.objects.core.Alignment.class, reader);
1007 } //-- org.vamsas.objects.core.Alignment unmarshal(java.io.Reader)
1013 public void validate()
1014 throws org.exolab.castor.xml.ValidationException
1016 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1017 validator.validate(this);
1018 } //-- void validate()