2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package uk.ac.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 uk.ac.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 referencing
59 private java.lang.String _id;
64 private java.lang.String _modifiable;
67 * This is annotation over the coordinate frame
68 * defined by all the columns in the alignment.
71 private java.util.Vector _alignmentAnnotationList;
76 private java.util.Vector _treeList;
79 * Field _alignmentSequenceList
81 private java.util.Vector _alignmentSequenceList;
84 * typical properties may be additional
85 * alignment score objects
87 private java.util.Vector _propertyList;
92 private uk.ac.vamsas.objects.core.Provenance _provenance;
102 _alignmentAnnotationList = new Vector();
103 _treeList = new Vector();
104 _alignmentSequenceList = new Vector();
105 _propertyList = new Vector();
106 } //-- uk.ac.vamsas.objects.core.Alignment()
114 * Method addAlignmentAnnotation
118 * @param vAlignmentAnnotation
120 public void addAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
121 throws java.lang.IndexOutOfBoundsException
123 _alignmentAnnotationList.addElement(vAlignmentAnnotation);
124 } //-- void addAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation)
127 * Method addAlignmentAnnotation
132 * @param vAlignmentAnnotation
134 public void addAlignmentAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
135 throws java.lang.IndexOutOfBoundsException
137 _alignmentAnnotationList.insertElementAt(vAlignmentAnnotation, index);
138 } //-- void addAlignmentAnnotation(int, uk.ac.vamsas.objects.core.AlignmentAnnotation)
141 * Method addAlignmentSequence
145 * @param vAlignmentSequence
147 public void addAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
148 throws java.lang.IndexOutOfBoundsException
150 _alignmentSequenceList.addElement(vAlignmentSequence);
151 } //-- void addAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence)
154 * Method addAlignmentSequence
159 * @param vAlignmentSequence
161 public void addAlignmentSequence(int index, uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
162 throws java.lang.IndexOutOfBoundsException
164 _alignmentSequenceList.insertElementAt(vAlignmentSequence, index);
165 } //-- void addAlignmentSequence(int, uk.ac.vamsas.objects.core.AlignmentSequence)
174 public void addProperty(uk.ac.vamsas.objects.core.Property vProperty)
175 throws java.lang.IndexOutOfBoundsException
177 _propertyList.addElement(vProperty);
178 } //-- void addProperty(uk.ac.vamsas.objects.core.Property)
188 public void addProperty(int index, uk.ac.vamsas.objects.core.Property vProperty)
189 throws java.lang.IndexOutOfBoundsException
191 _propertyList.insertElementAt(vProperty, index);
192 } //-- void addProperty(int, uk.ac.vamsas.objects.core.Property)
201 public void addTree(uk.ac.vamsas.objects.core.Tree vTree)
202 throws java.lang.IndexOutOfBoundsException
204 _treeList.addElement(vTree);
205 } //-- void addTree(uk.ac.vamsas.objects.core.Tree)
215 public void addTree(int index, uk.ac.vamsas.objects.core.Tree vTree)
216 throws java.lang.IndexOutOfBoundsException
218 _treeList.insertElementAt(vTree, index);
219 } //-- void addTree(int, uk.ac.vamsas.objects.core.Tree)
222 * Method deleteAligned
225 public void deleteAligned()
227 this._has_aligned= false;
228 } //-- void deleteAligned()
231 * Method enumerateAlignmentAnnotation
235 * @return Enumeration
237 public java.util.Enumeration enumerateAlignmentAnnotation()
239 return _alignmentAnnotationList.elements();
240 } //-- java.util.Enumeration enumerateAlignmentAnnotation()
243 * Method enumerateAlignmentSequence
247 * @return Enumeration
249 public java.util.Enumeration enumerateAlignmentSequence()
251 return _alignmentSequenceList.elements();
252 } //-- java.util.Enumeration enumerateAlignmentSequence()
255 * Method enumerateProperty
259 * @return Enumeration
261 public java.util.Enumeration enumerateProperty()
263 return _propertyList.elements();
264 } //-- java.util.Enumeration enumerateProperty()
267 * Method enumerateTree
271 * @return Enumeration
273 public java.util.Enumeration enumerateTree()
275 return _treeList.elements();
276 } //-- java.util.Enumeration enumerateTree()
279 * Note: hashCode() has not been overriden
284 public boolean equals(java.lang.Object obj)
289 if (super.equals(obj)==false)
292 if (obj instanceof Alignment) {
294 Alignment temp = (Alignment)obj;
295 if (this._gapChar != null) {
296 if (temp._gapChar == null) return false;
297 else if (!(this._gapChar.equals(temp._gapChar)))
300 else if (temp._gapChar != null)
302 if (this._aligned != temp._aligned)
304 if (this._has_aligned != temp._has_aligned)
306 if (this._id != null) {
307 if (temp._id == null) return false;
308 else if (!(this._id.equals(temp._id)))
311 else if (temp._id != null)
313 if (this._modifiable != null) {
314 if (temp._modifiable == null) return false;
315 else if (!(this._modifiable.equals(temp._modifiable)))
318 else if (temp._modifiable != null)
320 if (this._alignmentAnnotationList != null) {
321 if (temp._alignmentAnnotationList == null) return false;
322 else if (!(this._alignmentAnnotationList.equals(temp._alignmentAnnotationList)))
325 else if (temp._alignmentAnnotationList != null)
327 if (this._treeList != null) {
328 if (temp._treeList == null) return false;
329 else if (!(this._treeList.equals(temp._treeList)))
332 else if (temp._treeList != null)
334 if (this._alignmentSequenceList != null) {
335 if (temp._alignmentSequenceList == null) return false;
336 else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList)))
339 else if (temp._alignmentSequenceList != null)
341 if (this._propertyList != null) {
342 if (temp._propertyList == null) return false;
343 else if (!(this._propertyList.equals(temp._propertyList)))
346 else if (temp._propertyList != null)
348 if (this._provenance != null) {
349 if (temp._provenance == null) return false;
350 else if (!(this._provenance.equals(temp._provenance)))
353 else if (temp._provenance != null)
358 } //-- boolean equals(java.lang.Object)
361 * Returns the value of field 'aligned'.
364 * @return the value of field 'aligned'.
366 public boolean getAligned()
368 return this._aligned;
369 } //-- boolean getAligned()
372 * Method getAlignmentAnnotation
377 * @return AlignmentAnnotation
379 public uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int index)
380 throws java.lang.IndexOutOfBoundsException
382 //-- check bounds for index
383 if ((index < 0) || (index > _alignmentAnnotationList.size())) {
384 throw new IndexOutOfBoundsException("getAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
387 return (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
388 } //-- uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int)
391 * Method getAlignmentAnnotation
395 * @return AlignmentAnnotation
397 public uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation()
399 int size = _alignmentAnnotationList.size();
400 uk.ac.vamsas.objects.core.AlignmentAnnotation[] mArray = new uk.ac.vamsas.objects.core.AlignmentAnnotation[size];
401 for (int index = 0; index < size; index++) {
402 mArray[index] = (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
405 } //-- uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation()
408 * Method getAlignmentAnnotationCount
414 public int getAlignmentAnnotationCount()
416 return _alignmentAnnotationList.size();
417 } //-- int getAlignmentAnnotationCount()
420 * Method getAlignmentSequence
425 * @return AlignmentSequence
427 public uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index)
428 throws java.lang.IndexOutOfBoundsException
430 //-- check bounds for index
431 if ((index < 0) || (index > _alignmentSequenceList.size())) {
432 throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
435 return (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
436 } //-- uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int)
439 * Method getAlignmentSequence
443 * @return AlignmentSequence
445 public uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
447 int size = _alignmentSequenceList.size();
448 uk.ac.vamsas.objects.core.AlignmentSequence[] mArray = new uk.ac.vamsas.objects.core.AlignmentSequence[size];
449 for (int index = 0; index < size; index++) {
450 mArray[index] = (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
453 } //-- uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
456 * Method getAlignmentSequenceCount
462 public int getAlignmentSequenceCount()
464 return _alignmentSequenceList.size();
465 } //-- int getAlignmentSequenceCount()
468 * Returns the value of field 'gapChar'.
471 * @return the value of field 'gapChar'.
473 public java.lang.String getGapChar()
475 return this._gapChar;
476 } //-- java.lang.String getGapChar()
479 * Returns the value of field 'id'. The field 'id' has the
480 * following description: Primary Key for vamsas object
485 * @return the value of field 'id'.
487 public java.lang.String getId()
490 } //-- java.lang.String getId()
493 * Returns the value of field 'modifiable'.
496 * @return the value of field 'modifiable'.
498 public java.lang.String getModifiable()
500 return this._modifiable;
501 } //-- java.lang.String getModifiable()
511 public uk.ac.vamsas.objects.core.Property getProperty(int index)
512 throws java.lang.IndexOutOfBoundsException
514 //-- check bounds for index
515 if ((index < 0) || (index > _propertyList.size())) {
516 throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
519 return (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index);
520 } //-- uk.ac.vamsas.objects.core.Property getProperty(int)
529 public uk.ac.vamsas.objects.core.Property[] getProperty()
531 int size = _propertyList.size();
532 uk.ac.vamsas.objects.core.Property[] mArray = new uk.ac.vamsas.objects.core.Property[size];
533 for (int index = 0; index < size; index++) {
534 mArray[index] = (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index);
537 } //-- uk.ac.vamsas.objects.core.Property[] getProperty()
540 * Method getPropertyCount
546 public int getPropertyCount()
548 return _propertyList.size();
549 } //-- int getPropertyCount()
552 * Returns the value of field 'provenance'.
555 * @return the value of field 'provenance'.
557 public uk.ac.vamsas.objects.core.Provenance getProvenance()
559 return this._provenance;
560 } //-- uk.ac.vamsas.objects.core.Provenance getProvenance()
570 public uk.ac.vamsas.objects.core.Tree getTree(int index)
571 throws java.lang.IndexOutOfBoundsException
573 //-- check bounds for index
574 if ((index < 0) || (index > _treeList.size())) {
575 throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
578 return (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index);
579 } //-- uk.ac.vamsas.objects.core.Tree getTree(int)
588 public uk.ac.vamsas.objects.core.Tree[] getTree()
590 int size = _treeList.size();
591 uk.ac.vamsas.objects.core.Tree[] mArray = new uk.ac.vamsas.objects.core.Tree[size];
592 for (int index = 0; index < size; index++) {
593 mArray[index] = (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index);
596 } //-- uk.ac.vamsas.objects.core.Tree[] getTree()
599 * Method getTreeCount
605 public int getTreeCount()
607 return _treeList.size();
608 } //-- int getTreeCount()
617 public boolean hasAligned()
619 return this._has_aligned;
620 } //-- boolean hasAligned()
629 public boolean isValid()
634 catch (org.exolab.castor.xml.ValidationException vex) {
638 } //-- boolean isValid()
647 public void marshal(java.io.Writer out)
648 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
651 Marshaller.marshal(this, out);
652 } //-- void marshal(java.io.Writer)
661 public void marshal(org.xml.sax.ContentHandler handler)
662 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
665 Marshaller.marshal(this, handler);
666 } //-- void marshal(org.xml.sax.ContentHandler)
669 * Method removeAlignmentAnnotation
674 * @return AlignmentAnnotation
676 public uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int index)
678 java.lang.Object obj = _alignmentAnnotationList.elementAt(index);
679 _alignmentAnnotationList.removeElementAt(index);
680 return (uk.ac.vamsas.objects.core.AlignmentAnnotation) obj;
681 } //-- uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int)
684 * Method removeAlignmentSequence
689 * @return AlignmentSequence
691 public uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index)
693 java.lang.Object obj = _alignmentSequenceList.elementAt(index);
694 _alignmentSequenceList.removeElementAt(index);
695 return (uk.ac.vamsas.objects.core.AlignmentSequence) obj;
696 } //-- uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int)
699 * Method removeAllAlignmentAnnotation
702 public void removeAllAlignmentAnnotation()
704 _alignmentAnnotationList.removeAllElements();
705 } //-- void removeAllAlignmentAnnotation()
708 * Method removeAllAlignmentSequence
711 public void removeAllAlignmentSequence()
713 _alignmentSequenceList.removeAllElements();
714 } //-- void removeAllAlignmentSequence()
717 * Method removeAllProperty
720 public void removeAllProperty()
722 _propertyList.removeAllElements();
723 } //-- void removeAllProperty()
726 * Method removeAllTree
729 public void removeAllTree()
731 _treeList.removeAllElements();
732 } //-- void removeAllTree()
735 * Method removeProperty
742 public uk.ac.vamsas.objects.core.Property removeProperty(int index)
744 java.lang.Object obj = _propertyList.elementAt(index);
745 _propertyList.removeElementAt(index);
746 return (uk.ac.vamsas.objects.core.Property) obj;
747 } //-- uk.ac.vamsas.objects.core.Property removeProperty(int)
757 public uk.ac.vamsas.objects.core.Tree removeTree(int index)
759 java.lang.Object obj = _treeList.elementAt(index);
760 _treeList.removeElementAt(index);
761 return (uk.ac.vamsas.objects.core.Tree) obj;
762 } //-- uk.ac.vamsas.objects.core.Tree removeTree(int)
765 * Sets the value of field 'aligned'.
767 * @param aligned the value of field 'aligned'.
769 public void setAligned(boolean aligned)
771 this._aligned = aligned;
772 this._has_aligned = true;
773 } //-- void setAligned(boolean)
776 * Method setAlignmentAnnotation
781 * @param vAlignmentAnnotation
783 public void setAlignmentAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
784 throws java.lang.IndexOutOfBoundsException
786 //-- check bounds for index
787 if ((index < 0) || (index > _alignmentAnnotationList.size())) {
788 throw new IndexOutOfBoundsException("setAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
790 _alignmentAnnotationList.setElementAt(vAlignmentAnnotation, index);
791 } //-- void setAlignmentAnnotation(int, uk.ac.vamsas.objects.core.AlignmentAnnotation)
794 * Method setAlignmentAnnotation
798 * @param alignmentAnnotationArray
800 public void setAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation[] alignmentAnnotationArray)
803 _alignmentAnnotationList.removeAllElements();
804 for (int i = 0; i < alignmentAnnotationArray.length; i++) {
805 _alignmentAnnotationList.addElement(alignmentAnnotationArray[i]);
807 } //-- void setAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation)
810 * Method setAlignmentSequence
815 * @param vAlignmentSequence
817 public void setAlignmentSequence(int index, uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
818 throws java.lang.IndexOutOfBoundsException
820 //-- check bounds for index
821 if ((index < 0) || (index > _alignmentSequenceList.size())) {
822 throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
824 _alignmentSequenceList.setElementAt(vAlignmentSequence, index);
825 } //-- void setAlignmentSequence(int, uk.ac.vamsas.objects.core.AlignmentSequence)
828 * Method setAlignmentSequence
832 * @param alignmentSequenceArray
834 public void setAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray)
837 _alignmentSequenceList.removeAllElements();
838 for (int i = 0; i < alignmentSequenceArray.length; i++) {
839 _alignmentSequenceList.addElement(alignmentSequenceArray[i]);
841 } //-- void setAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence)
844 * Sets the value of field 'gapChar'.
846 * @param gapChar the value of field 'gapChar'.
848 public void setGapChar(java.lang.String gapChar)
850 this._gapChar = gapChar;
851 } //-- void setGapChar(java.lang.String)
854 * Sets the value of field 'id'. The field 'id' has the
855 * following description: Primary Key for vamsas object
859 * @param id the value of field 'id'.
861 public void setId(java.lang.String id)
864 } //-- void setId(java.lang.String)
867 * Sets the value of field 'modifiable'.
869 * @param modifiable the value of field 'modifiable'.
871 public void setModifiable(java.lang.String modifiable)
873 this._modifiable = modifiable;
874 } //-- void setModifiable(java.lang.String)
884 public void setProperty(int index, uk.ac.vamsas.objects.core.Property vProperty)
885 throws java.lang.IndexOutOfBoundsException
887 //-- check bounds for index
888 if ((index < 0) || (index > _propertyList.size())) {
889 throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
891 _propertyList.setElementAt(vProperty, index);
892 } //-- void setProperty(int, uk.ac.vamsas.objects.core.Property)
899 * @param propertyArray
901 public void setProperty(uk.ac.vamsas.objects.core.Property[] propertyArray)
904 _propertyList.removeAllElements();
905 for (int i = 0; i < propertyArray.length; i++) {
906 _propertyList.addElement(propertyArray[i]);
908 } //-- void setProperty(uk.ac.vamsas.objects.core.Property)
911 * Sets the value of field 'provenance'.
913 * @param provenance the value of field 'provenance'.
915 public void setProvenance(uk.ac.vamsas.objects.core.Provenance provenance)
917 this._provenance = provenance;
918 } //-- void setProvenance(uk.ac.vamsas.objects.core.Provenance)
928 public void setTree(int index, uk.ac.vamsas.objects.core.Tree vTree)
929 throws java.lang.IndexOutOfBoundsException
931 //-- check bounds for index
932 if ((index < 0) || (index > _treeList.size())) {
933 throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
935 _treeList.setElementAt(vTree, index);
936 } //-- void setTree(int, uk.ac.vamsas.objects.core.Tree)
945 public void setTree(uk.ac.vamsas.objects.core.Tree[] treeArray)
948 _treeList.removeAllElements();
949 for (int i = 0; i < treeArray.length; i++) {
950 _treeList.addElement(treeArray[i]);
952 } //-- void setTree(uk.ac.vamsas.objects.core.Tree)
962 public static uk.ac.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader)
963 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
965 return (uk.ac.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Alignment.class, reader);
966 } //-- uk.ac.vamsas.objects.core.Alignment unmarshal(java.io.Reader)
972 public void validate()
973 throws org.exolab.castor.xml.ValidationException
975 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
976 validator.validate(this);
977 } //-- void validate()