/* * This class was automatically generated with * Castor 1.1, using an XML * Schema. * $Id$ */ package uk.ac.vamsas.objects.core; //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; /** * Class SequenceMapping. * * @version $Revision$ $Date$ */ public class SequenceMapping extends uk.ac.vamsas.client.Vobject implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Field _sequenceA. */ private java.lang.Object _sequenceA; /** * Field _sequenceB. */ private java.lang.Object _sequenceB; /** * Field _id. */ private java.lang.String _id; /** * Field _rangeList. */ private java.util.Vector _rangeList; /** * Field _provenance. */ private uk.ac.vamsas.objects.core.Provenance _provenance; //----------------/ //- Constructors -/ //----------------/ public SequenceMapping() { super(); this._rangeList = new java.util.Vector(); } //-----------/ //- Methods -/ //-----------/ /** * * * @param vRange * @throws java.lang.IndexOutOfBoundsException if the index * given is outside the bounds of the collection */ public void addRange( final uk.ac.vamsas.objects.core.Range vRange) throws java.lang.IndexOutOfBoundsException { this._rangeList.addElement(vRange); } /** * * * @param index * @param vRange * @throws java.lang.IndexOutOfBoundsException if the index * given is outside the bounds of the collection */ public void addRange( final int index, final uk.ac.vamsas.objects.core.Range vRange) throws java.lang.IndexOutOfBoundsException { this._rangeList.add(index, vRange); } /** * Method enumerateRange. * * @return an Enumeration over all * uk.ac.vamsas.objects.core.Range elements */ public java.util.Enumeration enumerateRange( ) { return this._rangeList.elements(); } /** * Overrides the java.lang.Object.equals method. * * @param obj * @return true if the objects are equal. */ public boolean equals( final java.lang.Object obj) { if ( this == obj ) return true; if (super.equals(obj)==false) return false; if (obj instanceof SequenceMapping) { SequenceMapping temp = (SequenceMapping)obj; if (this._sequenceA != null) { if (temp._sequenceA == null) return false; else if (!(this._sequenceA.equals(temp._sequenceA))) return false; } else if (temp._sequenceA != null) return false; if (this._sequenceB != null) { if (temp._sequenceB == null) return false; else if (!(this._sequenceB.equals(temp._sequenceB))) return false; } else if (temp._sequenceB != null) 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._rangeList != null) { if (temp._rangeList == null) return false; else if (!(this._rangeList.equals(temp._rangeList))) return false; } else if (temp._rangeList != 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; } /** * Returns the value of field 'id'. * * @return the value of field 'Id'. */ public java.lang.String getId( ) { return this._id; } /** * Returns the value of field 'provenance'. * * @return the value of field 'Provenance'. */ public uk.ac.vamsas.objects.core.Provenance getProvenance( ) { return this._provenance; } /** * Method getRange. * * @param index * @throws java.lang.IndexOutOfBoundsException if the index * given is outside the bounds of the collection * @return the value of the uk.ac.vamsas.objects.core.Range at * the given index */ public uk.ac.vamsas.objects.core.Range getRange( final int index) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._rangeList.size()) { throw new IndexOutOfBoundsException("getRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]"); } return (uk.ac.vamsas.objects.core.Range) _rangeList.get(index); } /** * Method getRange.Returns the contents of the collection in an * Array.

Note: Just in case the collection contents are * changing in another thread, we pass a 0-length Array of the * correct type into the API call. This way we know * that the Array returned is of exactly the correct length. * * @return this collection as an Array */ public uk.ac.vamsas.objects.core.Range[] getRange( ) { uk.ac.vamsas.objects.core.Range[] array = new uk.ac.vamsas.objects.core.Range[0]; return (uk.ac.vamsas.objects.core.Range[]) this._rangeList.toArray(array); } /** * Method getRangeAsReference.Returns a reference to * '_rangeList'. No type checking is performed on any * modifications to the Vector. * * @return a reference to the Vector backing this class */ public java.util.Vector getRangeAsReference( ) { return this._rangeList; } /** * Method getRangeCount. * * @return the size of this collection */ public int getRangeCount( ) { return this._rangeList.size(); } /** * Returns the value of field 'sequenceA'. * * @return the value of field 'SequenceA'. */ public java.lang.Object getSequenceA( ) { return this._sequenceA; } /** * Returns the value of field 'sequenceB'. * * @return the value of field 'SequenceB'. */ public java.lang.Object getSequenceB( ) { return this._sequenceB; } /** * Overrides the java.lang.Object.hashCode method. *

* The following steps came from Effective Java Programming * Language Guide by Joshua Bloch, Chapter 3 * * @return a hash code value for the object. */ public int hashCode( ) { int result = super.hashCode(); long tmp; if (_sequenceA != null) { result = 37 * result + _sequenceA.hashCode(); } if (_sequenceB != null) { result = 37 * result + _sequenceB.hashCode(); } if (_id != null) { result = 37 * result + _id.hashCode(); } if (_rangeList != null) { result = 37 * result + _rangeList.hashCode(); } if (_provenance != null) { result = 37 * result + _provenance.hashCode(); } return result; } /** * Method isValid. * * @return true if this object is valid according to the schema */ public boolean isValid( ) { try { validate(); } catch (org.exolab.castor.xml.ValidationException vex) { return false; } return true; } /** * * * @param out * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema */ public void marshal( final java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, out); } /** * * * @param handler * @throws java.io.IOException if an IOException occurs during * marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling */ public void marshal( final org.xml.sax.ContentHandler handler) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, handler); } /** */ public void removeAllRange( ) { this._rangeList.clear(); } /** * Method removeRange. * * @param vRange * @return true if the object was removed from the collection. */ public boolean removeRange( final uk.ac.vamsas.objects.core.Range vRange) { boolean removed = _rangeList.remove(vRange); return removed; } /** * Method removeRangeAt. * * @param index * @return the element removed from the collection */ public uk.ac.vamsas.objects.core.Range removeRangeAt( final int index) { java.lang.Object obj = this._rangeList.remove(index); return (uk.ac.vamsas.objects.core.Range) obj; } /** * Sets the value of field 'id'. * * @param id the value of field 'id'. */ public void setId( final java.lang.String id) { this._id = id; } /** * Sets the value of field 'provenance'. * * @param provenance the value of field 'provenance'. */ public void setProvenance( final uk.ac.vamsas.objects.core.Provenance provenance) { this._provenance = provenance; } /** * * * @param index * @param vRange * @throws java.lang.IndexOutOfBoundsException if the index * given is outside the bounds of the collection */ public void setRange( final int index, final uk.ac.vamsas.objects.core.Range vRange) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._rangeList.size()) { throw new IndexOutOfBoundsException("setRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]"); } this._rangeList.set(index, vRange); } /** * * * @param vRangeArray */ public void setRange( final uk.ac.vamsas.objects.core.Range[] vRangeArray) { //-- copy array _rangeList.clear(); for (int i = 0; i < vRangeArray.length; i++) { this._rangeList.add(vRangeArray[i]); } } /** * Sets the value of '_rangeList' by copying the given Vector. * All elements will be checked for type safety. * * @param vRangeList the Vector to copy. */ public void setRange( final java.util.Vector vRangeList) { // copy vector this._rangeList.clear(); this._rangeList.addAll(vRangeList); } /** * Sets the value of '_rangeList' by setting it to the given * Vector. No type checking is performed. * @deprecated * * @param rangeVector the Vector to set. */ public void setRangeAsReference( final java.util.Vector rangeVector) { this._rangeList = rangeVector; } /** * Sets the value of field 'sequenceA'. * * @param sequenceA the value of field 'sequenceA'. */ public void setSequenceA( final java.lang.Object sequenceA) { this._sequenceA = sequenceA; } /** * Sets the value of field 'sequenceB'. * * @param sequenceB the value of field 'sequenceB'. */ public void setSequenceB( final java.lang.Object sequenceB) { this._sequenceB = sequenceB; } /** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled * uk.ac.vamsas.objects.core.SequenceMapping */ public static uk.ac.vamsas.objects.core.SequenceMapping unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.SequenceMapping) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader); } /** * * * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema */ public void validate( ) throws org.exolab.castor.xml.ValidationException { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); } }