/* * This class was automatically generated with * Castor 0.9.9M2, using an XML * Schema. * $Id:AlignmentSequence.java 264 2006-12-14 17:42:54Z JimP $ */ 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 AlignmentSequence. * * @version $Revision:264 $ $Date:2006-12-14 17:42:54 +0000 (Thu, 14 Dec 2006) $ */ public class AlignmentSequence extends uk.ac.vamsas.objects.core.SequenceType implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Primary Key for vamsas object * referencing */ private java.lang.String _id; /** * Dataset Sequence from which * this alignment sequence is taken from * */ private java.lang.Object _refid; /** * Field _alignmentSequenceAnnotationList */ private java.util.Vector _alignmentSequenceAnnotationList; //----------------/ //- Constructors -/ //----------------/ public AlignmentSequence() { super(); _alignmentSequenceAnnotationList = new Vector(); } //-- uk.ac.vamsas.objects.core.AlignmentSequence() //-----------/ //- Methods -/ //-----------/ /** * Method addAlignmentSequenceAnnotation * * * * @param vAlignmentSequenceAnnotation */ public void addAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) throws java.lang.IndexOutOfBoundsException { _alignmentSequenceAnnotationList.addElement(vAlignmentSequenceAnnotation); } //-- void addAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) /** * Method addAlignmentSequenceAnnotation * * * * @param index * @param vAlignmentSequenceAnnotation */ public void addAlignmentSequenceAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) throws java.lang.IndexOutOfBoundsException { _alignmentSequenceAnnotationList.insertElementAt(vAlignmentSequenceAnnotation, index); } //-- void addAlignmentSequenceAnnotation(int, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) /** * Method enumerateAlignmentSequenceAnnotation * * * * @return Enumeration */ public java.util.Enumeration enumerateAlignmentSequenceAnnotation() { return _alignmentSequenceAnnotationList.elements(); } //-- java.util.Enumeration enumerateAlignmentSequenceAnnotation() /** * 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 AlignmentSequence) { AlignmentSequence temp = (AlignmentSequence)obj; 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._refid != null) { if (temp._refid == null) return false; else if (!(this._refid.equals(temp._refid))) return false; } else if (temp._refid != null) return false; if (this._alignmentSequenceAnnotationList != null) { if (temp._alignmentSequenceAnnotationList == null) return false; else if (!(this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList))) return false; } else if (temp._alignmentSequenceAnnotationList != null) return false; return true; } return false; } //-- boolean equals(java.lang.Object) /** * Method getAlignmentSequenceAnnotation * * * * @param index * @return AlignmentSequenceAnnotation */ public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _alignmentSequenceAnnotationList.size())) { throw new IndexOutOfBoundsException("getAlignmentSequenceAnnotation: Index value '"+index+"' not in range [0.."+_alignmentSequenceAnnotationList.size()+ "]"); } return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index); } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int) /** * Method getAlignmentSequenceAnnotation * * * * @return AlignmentSequenceAnnotation */ public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation() { int size = _alignmentSequenceAnnotationList.size(); uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] mArray = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation() /** * Method getAlignmentSequenceAnnotationCount * * * * @return int */ public int getAlignmentSequenceAnnotationCount() { return _alignmentSequenceAnnotationList.size(); } //-- int getAlignmentSequenceAnnotationCount() /** * 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 'refid'. The field 'refid' has * the following description: Dataset Sequence from which * this alignment sequence is taken from * * * @return Object * @return the value of field 'refid'. */ public java.lang.Object getRefid() { return this._refid; } //-- java.lang.Object getRefid() /** * 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 removeAlignmentSequenceAnnotation * * * * @param index * @return AlignmentSequenceAnnotation */ public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int index) { java.lang.Object obj = _alignmentSequenceAnnotationList.elementAt(index); _alignmentSequenceAnnotationList.removeElementAt(index); return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) obj; } //-- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int) /** * Method removeAllAlignmentSequenceAnnotation * */ public void removeAllAlignmentSequenceAnnotation() { _alignmentSequenceAnnotationList.removeAllElements(); } //-- void removeAllAlignmentSequenceAnnotation() /** * Method setAlignmentSequenceAnnotation * * * * @param index * @param vAlignmentSequenceAnnotation */ public void setAlignmentSequenceAnnotation(int index, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _alignmentSequenceAnnotationList.size())) { throw new IndexOutOfBoundsException("setAlignmentSequenceAnnotation: Index value '"+index+"' not in range [0.."+_alignmentSequenceAnnotationList.size()+ "]"); } _alignmentSequenceAnnotationList.setElementAt(vAlignmentSequenceAnnotation, index); } //-- void setAlignmentSequenceAnnotation(int, uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) /** * Method setAlignmentSequenceAnnotation * * * * @param alignmentSequenceAnnotationArray */ public void setAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] alignmentSequenceAnnotationArray) { //-- copy array _alignmentSequenceAnnotationList.removeAllElements(); for (int i = 0; i < alignmentSequenceAnnotationArray.length; i++) { _alignmentSequenceAnnotationList.addElement(alignmentSequenceAnnotationArray[i]); } } //-- void setAlignmentSequenceAnnotation(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) /** * 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 'refid'. The field 'refid' has the * following description: Dataset Sequence from which * this alignment sequence is taken from * * * @param refid the value of field 'refid'. */ public void setRefid(java.lang.Object refid) { this._refid = refid; } //-- void setRefid(java.lang.Object) /** * Method unmarshal * * * * @param reader * @return SequenceType */ public static uk.ac.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.AlignmentSequence) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentSequence.class, reader); } //-- uk.ac.vamsas.objects.core.SequenceType 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() }