/* * 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 Sequence. * * @version $Revision$ $Date$ */ public class Sequence extends org.vamsas.objects.core.SequenceType implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Field _id */ private java.lang.String _id; /** * Field _dictionary */ private java.lang.String _dictionary; /** * Field _dbRefList */ private java.util.Vector _dbRefList; //----------------/ //- Constructors -/ //----------------/ public Sequence() { super(); _dbRefList = new Vector(); } //-- org.vamsas.objects.core.Sequence() //-----------/ //- Methods -/ //-----------/ /** * Method addDbRef * * * * @param vDbRef */ public void addDbRef(org.vamsas.objects.core.DbRef vDbRef) throws java.lang.IndexOutOfBoundsException { _dbRefList.addElement(vDbRef); } //-- void addDbRef(org.vamsas.objects.core.DbRef) /** * Method addDbRef * * * * @param index * @param vDbRef */ public void addDbRef(int index, org.vamsas.objects.core.DbRef vDbRef) throws java.lang.IndexOutOfBoundsException { _dbRefList.insertElementAt(vDbRef, index); } //-- void addDbRef(int, org.vamsas.objects.core.DbRef) /** * Method enumerateDbRef * * * * @return Enumeration */ public java.util.Enumeration enumerateDbRef() { return _dbRefList.elements(); } //-- java.util.Enumeration enumerateDbRef() /** * 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 Sequence) { Sequence temp = (Sequence)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._dictionary != null) { if (temp._dictionary == null) return false; else if (!(this._dictionary.equals(temp._dictionary))) return false; } else if (temp._dictionary != null) return false; if (this._dbRefList != null) { if (temp._dbRefList == null) return false; else if (!(this._dbRefList.equals(temp._dbRefList))) return false; } else if (temp._dbRefList != null) return false; return true; } return false; } //-- boolean equals(java.lang.Object) /** * Method getDbRef * * * * @param index * @return DbRef */ public org.vamsas.objects.core.DbRef getDbRef(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _dbRefList.size())) { throw new IndexOutOfBoundsException("getDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]"); } return (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index); } //-- org.vamsas.objects.core.DbRef getDbRef(int) /** * Method getDbRef * * * * @return DbRef */ public org.vamsas.objects.core.DbRef[] getDbRef() { int size = _dbRefList.size(); org.vamsas.objects.core.DbRef[] mArray = new org.vamsas.objects.core.DbRef[size]; for (int index = 0; index < size; index++) { mArray[index] = (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index); } return mArray; } //-- org.vamsas.objects.core.DbRef[] getDbRef() /** * Method getDbRefCount * * * * @return int */ public int getDbRefCount() { return _dbRefList.size(); } //-- int getDbRefCount() /** * Returns the value of field 'dictionary'. * * @return String * @return the value of field 'dictionary'. */ public java.lang.String getDictionary() { return this._dictionary; } //-- java.lang.String getDictionary() /** * 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() /** * 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 removeAllDbRef * */ public void removeAllDbRef() { _dbRefList.removeAllElements(); } //-- void removeAllDbRef() /** * Method removeDbRef * * * * @param index * @return DbRef */ public org.vamsas.objects.core.DbRef removeDbRef(int index) { java.lang.Object obj = _dbRefList.elementAt(index); _dbRefList.removeElementAt(index); return (org.vamsas.objects.core.DbRef) obj; } //-- org.vamsas.objects.core.DbRef removeDbRef(int) /** * Method setDbRef * * * * @param index * @param vDbRef */ public void setDbRef(int index, org.vamsas.objects.core.DbRef vDbRef) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _dbRefList.size())) { throw new IndexOutOfBoundsException("setDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]"); } _dbRefList.setElementAt(vDbRef, index); } //-- void setDbRef(int, org.vamsas.objects.core.DbRef) /** * Method setDbRef * * * * @param dbRefArray */ public void setDbRef(org.vamsas.objects.core.DbRef[] dbRefArray) { //-- copy array _dbRefList.removeAllElements(); for (int i = 0; i < dbRefArray.length; i++) { _dbRefList.addElement(dbRefArray[i]); } } //-- void setDbRef(org.vamsas.objects.core.DbRef) /** * Sets the value of field 'dictionary'. * * @param dictionary the value of field 'dictionary'. */ public void setDictionary(java.lang.String dictionary) { this._dictionary = dictionary; } //-- void setDictionary(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) /** * Method unmarshal * * * * @param reader * @return SequenceType */ public static org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.vamsas.objects.core.Sequence) Unmarshaller.unmarshal(org.vamsas.objects.core.Sequence.class, reader); } //-- org.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() }