/* * 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; /** * Store a list of database references * for this sequence record - with optional mapping * from database sequence to the given sequence record * * @version $Revision$ $Date$ */ public class DbRef extends uk.ac.vamsas.client.Vobject implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * TODO Database Naming * Convention: either start using LSID (so * change type to URI) or leave this as an * uncontrolled/unspecified string ID * */ private java.lang.String _source; /** * Version must be specified - * */ private java.lang.String _version; /** * TODO: make some specification * of the database field from which this * accessionId is taken from - should that be a * special property of the dbRef object ? * */ private java.lang.String _accessionId; /** * Primary Key for vamsas object * referencing */ private java.lang.String _id; /** * From: Offset to first * position in dataset sequence record that * this database entry maps to To: Offset * to last position in dataset sequence * record that this database entry maps to * Start: Offset to first last position in * database entry that first (or offset) * position in sequence maps to End: Offset * to last position in database entry that * last (offset) position in sequence maps * to */ private java.util.Vector _mapList; /** * Field _linkList */ private java.util.Vector _linkList; /** * Field _propertyList */ private java.util.Vector _propertyList; //----------------/ //- Constructors -/ //----------------/ public DbRef() { super(); _mapList = new Vector(); _linkList = new Vector(); _propertyList = new Vector(); } //-- uk.ac.vamsas.objects.core.DbRef() //-----------/ //- Methods -/ //-----------/ /** * Method addLink * * * * @param vLink */ public void addLink(uk.ac.vamsas.objects.core.Link vLink) throws java.lang.IndexOutOfBoundsException { _linkList.addElement(vLink); } //-- void addLink(uk.ac.vamsas.objects.core.Link) /** * Method addLink * * * * @param index * @param vLink */ public void addLink(int index, uk.ac.vamsas.objects.core.Link vLink) throws java.lang.IndexOutOfBoundsException { _linkList.insertElementAt(vLink, index); } //-- void addLink(int, uk.ac.vamsas.objects.core.Link) /** * Method addMap * * * * @param vMap */ public void addMap(uk.ac.vamsas.objects.core.Map vMap) throws java.lang.IndexOutOfBoundsException { _mapList.addElement(vMap); } //-- void addMap(uk.ac.vamsas.objects.core.Map) /** * Method addMap * * * * @param index * @param vMap */ public void addMap(int index, uk.ac.vamsas.objects.core.Map vMap) throws java.lang.IndexOutOfBoundsException { _mapList.insertElementAt(vMap, index); } //-- void addMap(int, uk.ac.vamsas.objects.core.Map) /** * 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 enumerateLink * * * * @return Enumeration */ public java.util.Enumeration enumerateLink() { return _linkList.elements(); } //-- java.util.Enumeration enumerateLink() /** * Method enumerateMap * * * * @return Enumeration */ public java.util.Enumeration enumerateMap() { return _mapList.elements(); } //-- java.util.Enumeration enumerateMap() /** * Method enumerateProperty * * * * @return Enumeration */ public java.util.Enumeration enumerateProperty() { return _propertyList.elements(); } //-- java.util.Enumeration enumerateProperty() /** * 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 DbRef) { DbRef temp = (DbRef)obj; if (this._source != null) { if (temp._source == null) return false; else if (!(this._source.equals(temp._source))) return false; } else if (temp._source != null) return false; if (this._version != null) { if (temp._version == null) return false; else if (!(this._version.equals(temp._version))) return false; } else if (temp._version != null) return false; if (this._accessionId != null) { if (temp._accessionId == null) return false; else if (!(this._accessionId.equals(temp._accessionId))) return false; } else if (temp._accessionId != 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._mapList != null) { if (temp._mapList == null) return false; else if (!(this._mapList.equals(temp._mapList))) return false; } else if (temp._mapList != null) return false; if (this._linkList != null) { if (temp._linkList == null) return false; else if (!(this._linkList.equals(temp._linkList))) return false; } else if (temp._linkList != 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; return true; } return false; } //-- boolean equals(java.lang.Object) /** * Returns the value of field 'accessionId'. The field * 'accessionId' has the following description: TODO: make some * specification * of the database field from which this * accessionId is taken from - should that be a * special property of the dbRef object ? * * * @return String * @return the value of field 'accessionId'. */ public java.lang.String getAccessionId() { return this._accessionId; } //-- java.lang.String getAccessionId() /** * 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() /** * Method getLink * * * * @param index * @return Link */ public uk.ac.vamsas.objects.core.Link getLink(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _linkList.size())) { throw new IndexOutOfBoundsException("getLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Link) _linkList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Link getLink(int) /** * Method getLink * * * * @return Link */ public uk.ac.vamsas.objects.core.Link[] getLink() { int size = _linkList.size(); uk.ac.vamsas.objects.core.Link[] mArray = new uk.ac.vamsas.objects.core.Link[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Link) _linkList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Link[] getLink() /** * Method getLinkCount * * * * @return int */ public int getLinkCount() { return _linkList.size(); } //-- int getLinkCount() /** * Method getMap * * * * @param index * @return Map */ public uk.ac.vamsas.objects.core.Map getMap(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _mapList.size())) { throw new IndexOutOfBoundsException("getMap: Index value '"+index+"' not in range [0.."+_mapList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Map) _mapList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Map getMap(int) /** * Method getMap * * * * @return Map */ public uk.ac.vamsas.objects.core.Map[] getMap() { int size = _mapList.size(); uk.ac.vamsas.objects.core.Map[] mArray = new uk.ac.vamsas.objects.core.Map[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Map) _mapList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Map[] getMap() /** * Method getMapCount * * * * @return int */ public int getMapCount() { return _mapList.size(); } //-- int getMapCount() /** * 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 'source'. The field 'source' has * the following description: TODO Database Naming * Convention: either start using LSID (so * change type to URI) or leave this as an * uncontrolled/unspecified string ID * * * @return String * @return the value of field 'source'. */ public java.lang.String getSource() { return this._source; } //-- java.lang.String getSource() /** * Returns the value of field 'version'. The field 'version' * has the following description: Version must be specified - * * * @return String * @return the value of field 'version'. */ public java.lang.String getVersion() { return this._version; } //-- java.lang.String getVersion() /** * 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 removeAllLink * */ public void removeAllLink() { _linkList.removeAllElements(); } //-- void removeAllLink() /** * Method removeAllMap * */ public void removeAllMap() { _mapList.removeAllElements(); } //-- void removeAllMap() /** * Method removeAllProperty * */ public void removeAllProperty() { _propertyList.removeAllElements(); } //-- void removeAllProperty() /** * Method removeLink * * * * @param index * @return Link */ public uk.ac.vamsas.objects.core.Link removeLink(int index) { java.lang.Object obj = _linkList.elementAt(index); _linkList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Link) obj; } //-- uk.ac.vamsas.objects.core.Link removeLink(int) /** * Method removeMap * * * * @param index * @return Map */ public uk.ac.vamsas.objects.core.Map removeMap(int index) { java.lang.Object obj = _mapList.elementAt(index); _mapList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Map) obj; } //-- uk.ac.vamsas.objects.core.Map removeMap(int) /** * 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) /** * Sets the value of field 'accessionId'. The field * 'accessionId' has the following description: TODO: make some * specification * of the database field from which this * accessionId is taken from - should that be a * special property of the dbRef object ? * * * @param accessionId the value of field 'accessionId'. */ public void setAccessionId(java.lang.String accessionId) { this._accessionId = accessionId; } //-- void setAccessionId(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) /** * Method setLink * * * * @param index * @param vLink */ public void setLink(int index, uk.ac.vamsas.objects.core.Link vLink) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _linkList.size())) { throw new IndexOutOfBoundsException("setLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]"); } _linkList.setElementAt(vLink, index); } //-- void setLink(int, uk.ac.vamsas.objects.core.Link) /** * Method setLink * * * * @param linkArray */ public void setLink(uk.ac.vamsas.objects.core.Link[] linkArray) { //-- copy array _linkList.removeAllElements(); for (int i = 0; i < linkArray.length; i++) { _linkList.addElement(linkArray[i]); } } //-- void setLink(uk.ac.vamsas.objects.core.Link) /** * Method setMap * * * * @param index * @param vMap */ public void setMap(int index, uk.ac.vamsas.objects.core.Map vMap) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _mapList.size())) { throw new IndexOutOfBoundsException("setMap: Index value '"+index+"' not in range [0.."+_mapList.size()+ "]"); } _mapList.setElementAt(vMap, index); } //-- void setMap(int, uk.ac.vamsas.objects.core.Map) /** * Method setMap * * * * @param mapArray */ public void setMap(uk.ac.vamsas.objects.core.Map[] mapArray) { //-- copy array _mapList.removeAllElements(); for (int i = 0; i < mapArray.length; i++) { _mapList.addElement(mapArray[i]); } } //-- void setMap(uk.ac.vamsas.objects.core.Map) /** * 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 'source'. The field 'source' has the * following description: TODO Database Naming * Convention: either start using LSID (so * change type to URI) or leave this as an * uncontrolled/unspecified string ID * * * @param source the value of field 'source'. */ public void setSource(java.lang.String source) { this._source = source; } //-- void setSource(java.lang.String) /** * Sets the value of field 'version'. The field 'version' has * the following description: Version must be specified - * * * @param version the value of field 'version'. */ public void setVersion(java.lang.String version) { this._version = version; } //-- void setVersion(java.lang.String) /** * Method unmarshal * * * * @param reader * @return DbRef */ public static uk.ac.vamsas.objects.core.DbRef unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.DbRef) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DbRef.class, reader); } //-- uk.ac.vamsas.objects.core.DbRef 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() }