/* * This class was automatically generated with * Castor 0.9.9M2, using an XML * Schema. * $Id$ */ package org.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 org.vamsas.client.object 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; /** * Field _id */ private java.lang.String _id; /** * Field _alignmentAnnotations */ private org.vamsas.objects.core.AlignmentAnnotations _alignmentAnnotations; /** * Field _treeList */ private java.util.Vector _treeList; /** * Field _alignmentSequenceList */ private java.util.Vector _alignmentSequenceList; /** * Field _provenance */ private org.vamsas.objects.core.Provenance _provenance; //----------------/ //- Constructors -/ //----------------/ public Alignment() { super(); _treeList = new Vector(); _alignmentSequenceList = new Vector(); } //-- org.vamsas.objects.core.Alignment() //-----------/ //- Methods -/ //-----------/ /** * Method addAlignmentSequence * * * * @param vAlignmentSequence */ public void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence vAlignmentSequence) throws java.lang.IndexOutOfBoundsException { _alignmentSequenceList.addElement(vAlignmentSequence); } //-- void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) /** * Method addAlignmentSequence * * * * @param index * @param vAlignmentSequence */ public void addAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence) throws java.lang.IndexOutOfBoundsException { _alignmentSequenceList.insertElementAt(vAlignmentSequence, index); } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) /** * Method addTree * * * * @param vTree */ public void addTree(org.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { _treeList.addElement(vTree); } //-- void addTree(org.vamsas.objects.core.Tree) /** * Method addTree * * * * @param index * @param vTree */ public void addTree(int index, org.vamsas.objects.core.Tree vTree) throws java.lang.IndexOutOfBoundsException { _treeList.insertElementAt(vTree, index); } //-- void addTree(int, org.vamsas.objects.core.Tree) /** * Method deleteAligned * */ public void deleteAligned() { this._has_aligned= false; } //-- void deleteAligned() /** * Method enumerateAlignmentSequence * * * * @return Enumeration */ public java.util.Enumeration enumerateAlignmentSequence() { return _alignmentSequenceList.elements(); } //-- java.util.Enumeration enumerateAlignmentSequence() /** * 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._alignmentAnnotations != null) { if (temp._alignmentAnnotations == null) return false; else if (!(this._alignmentAnnotations.equals(temp._alignmentAnnotations))) return false; } else if (temp._alignmentAnnotations != 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._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() /** * Returns the value of field 'alignmentAnnotations'. * * @return AlignmentAnnotations * @return the value of field 'alignmentAnnotations'. */ public org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() { return this._alignmentAnnotations; } //-- org.vamsas.objects.core.AlignmentAnnotations getAlignmentAnnotations() /** * Method getAlignmentSequence * * * * @param index * @return AlignmentSequence */ public org.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 (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index); } //-- org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int) /** * Method getAlignmentSequence * * * * @return AlignmentSequence */ public org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() { int size = _alignmentSequenceList.size(); org.vamsas.objects.core.AlignmentSequence[] mArray = new org.vamsas.objects.core.AlignmentSequence[size]; for (int index = 0; index < size; index++) { mArray[index] = (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index); } return mArray; } //-- org.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'. * * @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 'provenance'. * * @return Provenance * @return the value of field 'provenance'. */ public org.vamsas.objects.core.Provenance getProvenance() { return this._provenance; } //-- org.vamsas.objects.core.Provenance getProvenance() /** * Method getTree * * * * @param index * @return Tree */ public org.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 (org.vamsas.objects.core.Tree) _treeList.elementAt(index); } //-- org.vamsas.objects.core.Tree getTree(int) /** * Method getTree * * * * @return Tree */ public org.vamsas.objects.core.Tree[] getTree() { int size = _treeList.size(); org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size]; for (int index = 0; index < size; index++) { mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index); } return mArray; } //-- org.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 removeAlignmentSequence * * * * @param index * @return AlignmentSequence */ public org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index) { java.lang.Object obj = _alignmentSequenceList.elementAt(index); _alignmentSequenceList.removeElementAt(index); return (org.vamsas.objects.core.AlignmentSequence) obj; } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) /** * Method removeAllAlignmentSequence * */ public void removeAllAlignmentSequence() { _alignmentSequenceList.removeAllElements(); } //-- void removeAllAlignmentSequence() /** * Method removeAllTree * */ public void removeAllTree() { _treeList.removeAllElements(); } //-- void removeAllTree() /** * Method removeTree * * * * @param index * @return Tree */ public org.vamsas.objects.core.Tree removeTree(int index) { java.lang.Object obj = _treeList.elementAt(index); _treeList.removeElementAt(index); return (org.vamsas.objects.core.Tree) obj; } //-- org.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) /** * Sets the value of field 'alignmentAnnotations'. * * @param alignmentAnnotations the value of field * 'alignmentAnnotations'. */ public void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations alignmentAnnotations) { this._alignmentAnnotations = alignmentAnnotations; } //-- void setAlignmentAnnotations(org.vamsas.objects.core.AlignmentAnnotations) /** * Method setAlignmentSequence * * * * @param index * @param vAlignmentSequence */ public void setAlignmentSequence(int index, org.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, org.vamsas.objects.core.AlignmentSequence) /** * Method setAlignmentSequence * * * * @param alignmentSequenceArray */ public void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray) { //-- copy array _alignmentSequenceList.removeAllElements(); for (int i = 0; i < alignmentSequenceArray.length; i++) { _alignmentSequenceList.addElement(alignmentSequenceArray[i]); } } //-- void setAlignmentSequence(org.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'. * * @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 'provenance'. * * @param provenance the value of field 'provenance'. */ public void setProvenance(org.vamsas.objects.core.Provenance provenance) { this._provenance = provenance; } //-- void setProvenance(org.vamsas.objects.core.Provenance) /** * Method setTree * * * * @param index * @param vTree */ public void setTree(int index, org.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, org.vamsas.objects.core.Tree) /** * Method setTree * * * * @param treeArray */ public void setTree(org.vamsas.objects.core.Tree[] treeArray) { //-- copy array _treeList.removeAllElements(); for (int i = 0; i < treeArray.length; i++) { _treeList.addElement(treeArray[i]); } } //-- void setTree(org.vamsas.objects.core.Tree) /** * Method unmarshal * * * * @param reader * @return Alignment */ public static org.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(org.vamsas.objects.core.Alignment.class, reader); } //-- org.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() }