/* * This class was automatically generated with * Castor 0.9.9M2, using an XML * Schema. * $Id$ */ package uk.ac.vamsas.objects.core; //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ import java.io.IOException; import java.io.Reader; import java.io.Serializable; import java.io.Writer; import java.util.Enumeration; import java.util.Vector; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** * Class Alignment. * * @version $Revision$ $Date$ */ public class Alignment extends uk.ac.vamsas.client.Vobject implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Field _gapChar */ private java.lang.String _gapChar; /** * Field _aligned */ private boolean _aligned; /** * keeps track of state for field: _aligned */ private boolean _has_aligned; /** * Primary Key for vamsas object referencing * */ private java.lang.String _id; /** * Field _modifiable */ private java.lang.String _modifiable; /** * This is annotation over the coordinate frame * defined by all the columns in the alignment. * */ private java.util.Vector _alignmentAnnotationList; /** * Field _treeList */ private java.util.Vector _treeList; /** * Field _alignmentSequenceList */ private java.util.Vector _alignmentSequenceList; /** * typical properties may be additional * alignment score objects */ private java.util.Vector _propertyList; /** * Field _provenance */ private uk.ac.vamsas.objects.core.Provenance _provenance; //----------------/ //- Constructors -/ //----------------/ public Alignment() { super(); _alignmentAnnotationList = new Vector(); _treeList = new Vector(); _alignmentSequenceList = new Vector(); _propertyList = new Vector(); } //-- uk.ac.vamsas.objects.core.Alignment() //-----------/ //- Methods -/ //-----------/ /** * Method addAlignmentAnnotation * * * * @param vAlignmentAnnotation */ public void addAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation) throws java.lang.IndexOutOfBoundsException { _alignmentAnnotationList.addElement(vAlignmentAnnotation); } //-- void addAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation) /** * Method addAlignmentAnnotation * * * * @param index * @param vAlignmentAnnotation */ public void addAlignmentAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation) throws java.lang.IndexOutOfBoundsException { _alignmentAnnotationList.insertElementAt(vAlignmentAnnotation, index); } //-- void addAlignmentAnnotation(int, uk.ac.vamsas.objects.core.AlignmentAnnotation) /** * Method addAlignmentSequence * * * * @param vAlignmentSequence */ public void addAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence) throws java.lang.IndexOutOfBoundsException { _alignmentSequenceList.addElement(vAlignmentSequence); } //-- void addAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence) /** * Method addAlignmentSequence * * * * @param index * @param vAlignmentSequence */ public void addAlignmentSequence(int index, uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence) throws java.lang.IndexOutOfBoundsException { _alignmentSequenceList.insertElementAt(vAlignmentSequence, index); } //-- void addAlignmentSequence(int, uk.ac.vamsas.objects.core.AlignmentSequence) /** * Method addProperty * * * * @param vProperty */ public void addProperty(uk.ac.vamsas.objects.core.Property vProperty) throws java.lang.IndexOutOfBoundsException { _propertyList.addElement(vProperty); } //-- void addProperty(uk.ac.vamsas.objects.core.Property) /** * Method addProperty * * * * @param index * @param vProperty */ public void addProperty(int index, uk.ac.vamsas.objects.core.Property vProperty) throws java.lang.IndexOutOfBoundsException { _propertyList.insertElementAt(vProperty, index); } //-- void addProperty(int, uk.ac.vamsas.objects.core.Property) /** * Method addTree * * * * @param vTree */ public void addTree(uk.ac.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { _treeList.addElement(vTree); } //-- void addTree(uk.ac.vamsas.objects.core.Tree) /** * Method addTree * * * * @param index * @param vTree */ public void addTree(int index, uk.ac.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { _treeList.insertElementAt(vTree, index); } //-- void addTree(int, uk.ac.vamsas.objects.core.Tree) /** * Method deleteAligned * */ public void deleteAligned() { this._has_aligned= false; } //-- void deleteAligned() /** * Method enumerateAlignmentAnnotation * * * * @return Enumeration */ public java.util.Enumeration enumerateAlignmentAnnotation() { return _alignmentAnnotationList.elements(); } //-- java.util.Enumeration enumerateAlignmentAnnotation() /** * Method enumerateAlignmentSequence * * * * @return Enumeration */ public java.util.Enumeration enumerateAlignmentSequence() { return _alignmentSequenceList.elements(); } //-- java.util.Enumeration enumerateAlignmentSequence() /** * Method enumerateProperty * * * * @return Enumeration */ public java.util.Enumeration enumerateProperty() { return _propertyList.elements(); } //-- java.util.Enumeration enumerateProperty() /** * Method enumerateTree * * * * @return Enumeration */ public java.util.Enumeration enumerateTree() { return _treeList.elements(); } //-- java.util.Enumeration enumerateTree() /** * Note: hashCode() has not been overriden * * @param obj * @return boolean */ public boolean equals(java.lang.Object obj) { if ( this == obj ) return true; if (super.equals(obj)==false) return false; if (obj instanceof Alignment) { Alignment temp = (Alignment)obj; if (this._gapChar != null) { if (temp._gapChar == null) return false; else if (!(this._gapChar.equals(temp._gapChar))) return false; } else if (temp._gapChar != null) return false; if (this._aligned != temp._aligned) return false; if (this._has_aligned != temp._has_aligned) return false; if (this._id != null) { if (temp._id == null) return false; else if (!(this._id.equals(temp._id))) return false; } else if (temp._id != null) return false; if (this._modifiable != null) { if (temp._modifiable == null) return false; else if (!(this._modifiable.equals(temp._modifiable))) return false; } else if (temp._modifiable != null) return false; if (this._alignmentAnnotationList != null) { if (temp._alignmentAnnotationList == null) return false; else if (!(this._alignmentAnnotationList.equals(temp._alignmentAnnotationList))) return false; } else if (temp._alignmentAnnotationList != null) return false; if (this._treeList != null) { if (temp._treeList == null) return false; else if (!(this._treeList.equals(temp._treeList))) return false; } else if (temp._treeList != null) return false; if (this._alignmentSequenceList != null) { if (temp._alignmentSequenceList == null) return false; else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList))) return false; } else if (temp._alignmentSequenceList != null) return false; if (this._propertyList != null) { if (temp._propertyList == null) return false; else if (!(this._propertyList.equals(temp._propertyList))) return false; } else if (temp._propertyList != null) return false; if (this._provenance != null) { if (temp._provenance == null) return false; else if (!(this._provenance.equals(temp._provenance))) return false; } else if (temp._provenance != null) return false; return true; } return false; } //-- boolean equals(java.lang.Object) /** * Returns the value of field 'aligned'. * * @return boolean * @return the value of field 'aligned'. */ public boolean getAligned() { return this._aligned; } //-- boolean getAligned() /** * Method getAlignmentAnnotation * * * * @param index * @return AlignmentAnnotation */ public uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _alignmentAnnotationList.size())) { throw new IndexOutOfBoundsException("getAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]"); } return (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index); } //-- uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int) /** * Method getAlignmentAnnotation * * * * @return AlignmentAnnotation */ public uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation() { int size = _alignmentAnnotationList.size(); uk.ac.vamsas.objects.core.AlignmentAnnotation[] mArray = new uk.ac.vamsas.objects.core.AlignmentAnnotation[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation() /** * Method getAlignmentAnnotationCount * * * * @return int */ public int getAlignmentAnnotationCount() { return _alignmentAnnotationList.size(); } //-- int getAlignmentAnnotationCount() /** * Method getAlignmentSequence * * * * @param index * @return AlignmentSequence */ public uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _alignmentSequenceList.size())) { throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]"); } return (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index); } //-- uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int) /** * Method getAlignmentSequence * * * * @return AlignmentSequence */ public uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() { int size = _alignmentSequenceList.size(); uk.ac.vamsas.objects.core.AlignmentSequence[] mArray = new uk.ac.vamsas.objects.core.AlignmentSequence[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() /** * Method getAlignmentSequenceCount * * * * @return int */ public int getAlignmentSequenceCount() { return _alignmentSequenceList.size(); } //-- int getAlignmentSequenceCount() /** * Returns the value of field 'gapChar'. * * @return String * @return the value of field 'gapChar'. */ public java.lang.String getGapChar() { return this._gapChar; } //-- java.lang.String getGapChar() /** * Returns the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object * referencing * * * @return String * @return the value of field 'id'. */ public java.lang.String getId() { return this._id; } //-- java.lang.String getId() /** * Returns the value of field 'modifiable'. * * @return String * @return the value of field 'modifiable'. */ public java.lang.String getModifiable() { return this._modifiable; } //-- java.lang.String getModifiable() /** * Method getProperty * * * * @param index * @return Property */ public uk.ac.vamsas.objects.core.Property getProperty(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _propertyList.size())) { throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Property getProperty(int) /** * Method getProperty * * * * @return Property */ public uk.ac.vamsas.objects.core.Property[] getProperty() { int size = _propertyList.size(); uk.ac.vamsas.objects.core.Property[] mArray = new uk.ac.vamsas.objects.core.Property[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Property[] getProperty() /** * Method getPropertyCount * * * * @return int */ public int getPropertyCount() { return _propertyList.size(); } //-- int getPropertyCount() /** * Returns the value of field 'provenance'. * * @return Provenance * @return the value of field 'provenance'. */ public uk.ac.vamsas.objects.core.Provenance getProvenance() { return this._provenance; } //-- uk.ac.vamsas.objects.core.Provenance getProvenance() /** * Method getTree * * * * @param index * @return Tree */ public uk.ac.vamsas.objects.core.Tree getTree(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _treeList.size())) { throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Tree getTree(int) /** * Method getTree * * * * @return Tree */ public uk.ac.vamsas.objects.core.Tree[] getTree() { int size = _treeList.size(); uk.ac.vamsas.objects.core.Tree[] mArray = new uk.ac.vamsas.objects.core.Tree[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Tree[] getTree() /** * Method getTreeCount * * * * @return int */ public int getTreeCount() { return _treeList.size(); } //-- int getTreeCount() /** * Method hasAligned * * * * @return boolean */ public boolean hasAligned() { return this._has_aligned; } //-- boolean hasAligned() /** * Method isValid * * * * @return boolean */ public boolean isValid() { try { validate(); } catch (org.exolab.castor.xml.ValidationException vex) { return false; } return true; } //-- boolean isValid() /** * Method marshal * * * * @param out */ public void marshal(java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, out); } //-- void marshal(java.io.Writer) /** * Method marshal * * * * @param handler */ public void marshal(org.xml.sax.ContentHandler handler) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, handler); } //-- void marshal(org.xml.sax.ContentHandler) /** * Method removeAlignmentAnnotation * * * * @param index * @return AlignmentAnnotation */ public uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int index) { java.lang.Object obj = _alignmentAnnotationList.elementAt(index); _alignmentAnnotationList.removeElementAt(index); return (uk.ac.vamsas.objects.core.AlignmentAnnotation) obj; } //-- uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int) /** * Method removeAlignmentSequence * * * * @param index * @return AlignmentSequence */ public uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index) { java.lang.Object obj = _alignmentSequenceList.elementAt(index); _alignmentSequenceList.removeElementAt(index); return (uk.ac.vamsas.objects.core.AlignmentSequence) obj; } //-- uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) /** * Method removeAllAlignmentAnnotation * */ public void removeAllAlignmentAnnotation() { _alignmentAnnotationList.removeAllElements(); } //-- void removeAllAlignmentAnnotation() /** * Method removeAllAlignmentSequence * */ public void removeAllAlignmentSequence() { _alignmentSequenceList.removeAllElements(); } //-- void removeAllAlignmentSequence() /** * Method removeAllProperty * */ public void removeAllProperty() { _propertyList.removeAllElements(); } //-- void removeAllProperty() /** * Method removeAllTree * */ public void removeAllTree() { _treeList.removeAllElements(); } //-- void removeAllTree() /** * Method removeProperty * * * * @param index * @return Property */ public uk.ac.vamsas.objects.core.Property removeProperty(int index) { java.lang.Object obj = _propertyList.elementAt(index); _propertyList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Property) obj; } //-- uk.ac.vamsas.objects.core.Property removeProperty(int) /** * Method removeTree * * * * @param index * @return Tree */ public uk.ac.vamsas.objects.core.Tree removeTree(int index) { java.lang.Object obj = _treeList.elementAt(index); _treeList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Tree) obj; } //-- uk.ac.vamsas.objects.core.Tree removeTree(int) /** * Sets the value of field 'aligned'. * * @param aligned the value of field 'aligned'. */ public void setAligned(boolean aligned) { this._aligned = aligned; this._has_aligned = true; } //-- void setAligned(boolean) /** * Method setAlignmentAnnotation * * * * @param index * @param vAlignmentAnnotation */ public void setAlignmentAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _alignmentAnnotationList.size())) { throw new IndexOutOfBoundsException("setAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]"); } _alignmentAnnotationList.setElementAt(vAlignmentAnnotation, index); } //-- void setAlignmentAnnotation(int, uk.ac.vamsas.objects.core.AlignmentAnnotation) /** * Method setAlignmentAnnotation * * * * @param alignmentAnnotationArray */ public void setAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation[] alignmentAnnotationArray) { //-- copy array _alignmentAnnotationList.removeAllElements(); for (int i = 0; i < alignmentAnnotationArray.length; i++) { _alignmentAnnotationList.addElement(alignmentAnnotationArray[i]); } } //-- void setAlignmentAnnotation(uk.ac.vamsas.objects.core.AlignmentAnnotation) /** * Method setAlignmentSequence * * * * @param index * @param vAlignmentSequence */ public void setAlignmentSequence(int index, uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _alignmentSequenceList.size())) { throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]"); } _alignmentSequenceList.setElementAt(vAlignmentSequence, index); } //-- void setAlignmentSequence(int, uk.ac.vamsas.objects.core.AlignmentSequence) /** * Method setAlignmentSequence * * * * @param alignmentSequenceArray */ public void setAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray) { //-- copy array _alignmentSequenceList.removeAllElements(); for (int i = 0; i < alignmentSequenceArray.length; i++) { _alignmentSequenceList.addElement(alignmentSequenceArray[i]); } } //-- void setAlignmentSequence(uk.ac.vamsas.objects.core.AlignmentSequence) /** * Sets the value of field 'gapChar'. * * @param gapChar the value of field 'gapChar'. */ public void setGapChar(java.lang.String gapChar) { this._gapChar = gapChar; } //-- void setGapChar(java.lang.String) /** * Sets the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object * referencing * * * @param id the value of field 'id'. */ public void setId(java.lang.String id) { this._id = id; } //-- void setId(java.lang.String) /** * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; } //-- void setModifiable(java.lang.String) /** * Method setProperty * * * * @param index * @param vProperty */ public void setProperty(int index, uk.ac.vamsas.objects.core.Property vProperty) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _propertyList.size())) { throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]"); } _propertyList.setElementAt(vProperty, index); } //-- void setProperty(int, uk.ac.vamsas.objects.core.Property) /** * Method setProperty * * * * @param propertyArray */ public void setProperty(uk.ac.vamsas.objects.core.Property[] propertyArray) { //-- copy array _propertyList.removeAllElements(); for (int i = 0; i < propertyArray.length; i++) { _propertyList.addElement(propertyArray[i]); } } //-- void setProperty(uk.ac.vamsas.objects.core.Property) /** * Sets the value of field 'provenance'. * * @param provenance the value of field 'provenance'. */ public void setProvenance(uk.ac.vamsas.objects.core.Provenance provenance) { this._provenance = provenance; } //-- void setProvenance(uk.ac.vamsas.objects.core.Provenance) /** * Method setTree * * * * @param index * @param vTree */ public void setTree(int index, uk.ac.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _treeList.size())) { throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]"); } _treeList.setElementAt(vTree, index); } //-- void setTree(int, uk.ac.vamsas.objects.core.Tree) /** * Method setTree * * * * @param treeArray */ public void setTree(uk.ac.vamsas.objects.core.Tree[] treeArray) { //-- copy array _treeList.removeAllElements(); for (int i = 0; i < treeArray.length; i++) { _treeList.addElement(treeArray[i]); } } //-- void setTree(uk.ac.vamsas.objects.core.Tree) /** * Method unmarshal * * * * @param reader * @return Alignment */ public static uk.ac.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Alignment.class, reader); } //-- uk.ac.vamsas.objects.core.Alignment unmarshal(java.io.Reader) /** * Method validate * */ public void validate() throws org.exolab.castor.xml.ValidationException { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); } //-- void validate() }