/* * 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; /** * Annotation for a rangeSpec - values can be attached for the * whole * specification, and to each position within the spec. following * the orientation * specified by the ordered set of rangeSpec (pos, seg) elements. * * @version $Revision$ $Date$ */ public class RangeAnnotation extends uk.ac.vamsas.objects.core.RangeType implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Primary Key for vamsas object referencing * */ private java.lang.String _id; /** * Field _modifiable */ private java.lang.String _modifiable; /** * Annotation with the same non-empty group name are grouped * together */ private java.lang.String _group = ""; /** * A Das Feature has both a type and a Type ID. We go the * route of requiring the type string to be taken from a * controlled * vocabulary if an application expects others to make sense * of it. The * type may qualified - so uniprot:CHAIN is a valid type name, * and * considered distinct from someotherDB:CHAIN */ private java.lang.String _type; /** * Short, meaningful name for the annotation - if this * is absent, then the type string should be used in its * place. * */ private java.lang.String _label; /** * Human readable description of the annotation * */ private java.lang.String _description; /** * TODO: specify this - we have considered taking the GO * evidence codes as a model for assessing a measure of * quality to an * annotation. */ private java.lang.String _status; /** * Annotation Element position maps to ordered positions * defined by the sequence of rangeType pos positions or * concatenated * seg start/end segments. */ private java.util.Vector _annotationElementList; /** * Ordered set of optionally named float values for the * whole annotation */ private java.util.Vector _scoreList; /** * Field _linkList */ private java.util.Vector _linkList; /** * Note:These are mutable so an application should check * them each time. */ private java.util.Vector _propertyList; //----------------/ //- Constructors -/ //----------------/ public RangeAnnotation() { super(); setGroup(""); _annotationElementList = new Vector(); _scoreList = new Vector(); _linkList = new Vector(); _propertyList = new Vector(); } //-- uk.ac.vamsas.objects.core.RangeAnnotation() //-----------/ //- Methods -/ //-----------/ /** * Method addAnnotationElement * * * * @param vAnnotationElement */ public void addAnnotationElement(uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement) throws java.lang.IndexOutOfBoundsException { _annotationElementList.addElement(vAnnotationElement); } //-- void addAnnotationElement(uk.ac.vamsas.objects.core.AnnotationElement) /** * Method addAnnotationElement * * * * @param index * @param vAnnotationElement */ public void addAnnotationElement(int index, uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement) throws java.lang.IndexOutOfBoundsException { _annotationElementList.insertElementAt(vAnnotationElement, index); } //-- void addAnnotationElement(int, uk.ac.vamsas.objects.core.AnnotationElement) /** * 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 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 addScore * * * * @param vScore */ public void addScore(uk.ac.vamsas.objects.core.Score vScore) throws java.lang.IndexOutOfBoundsException { _scoreList.addElement(vScore); } //-- void addScore(uk.ac.vamsas.objects.core.Score) /** * Method addScore * * * * @param index * @param vScore */ public void addScore(int index, uk.ac.vamsas.objects.core.Score vScore) throws java.lang.IndexOutOfBoundsException { _scoreList.insertElementAt(vScore, index); } //-- void addScore(int, uk.ac.vamsas.objects.core.Score) /** * Method enumerateAnnotationElement * * * * @return Enumeration */ public java.util.Enumeration enumerateAnnotationElement() { return _annotationElementList.elements(); } //-- java.util.Enumeration enumerateAnnotationElement() /** * Method enumerateLink * * * * @return Enumeration */ public java.util.Enumeration enumerateLink() { return _linkList.elements(); } //-- java.util.Enumeration enumerateLink() /** * Method enumerateProperty * * * * @return Enumeration */ public java.util.Enumeration enumerateProperty() { return _propertyList.elements(); } //-- java.util.Enumeration enumerateProperty() /** * Method enumerateScore * * * * @return Enumeration */ public java.util.Enumeration enumerateScore() { return _scoreList.elements(); } //-- java.util.Enumeration enumerateScore() /** * 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 RangeAnnotation) { RangeAnnotation temp = (RangeAnnotation)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._modifiable != null) { if (temp._modifiable == null) return false; else if (!(this._modifiable.equals(temp._modifiable))) return false; } else if (temp._modifiable != null) return false; if (this._group != null) { if (temp._group == null) return false; else if (!(this._group.equals(temp._group))) return false; } else if (temp._group != null) return false; if (this._type != null) { if (temp._type == null) return false; else if (!(this._type.equals(temp._type))) return false; } else if (temp._type != null) return false; if (this._label != null) { if (temp._label == null) return false; else if (!(this._label.equals(temp._label))) return false; } else if (temp._label != null) return false; if (this._description != null) { if (temp._description == null) return false; else if (!(this._description.equals(temp._description))) return false; } else if (temp._description != null) return false; if (this._status != null) { if (temp._status == null) return false; else if (!(this._status.equals(temp._status))) return false; } else if (temp._status != null) return false; if (this._annotationElementList != null) { if (temp._annotationElementList == null) return false; else if (!(this._annotationElementList.equals(temp._annotationElementList))) return false; } else if (temp._annotationElementList != null) return false; if (this._scoreList != null) { if (temp._scoreList == null) return false; else if (!(this._scoreList.equals(temp._scoreList))) return false; } else if (temp._scoreList != 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) /** * Method getAnnotationElement * * * * @param index * @return AnnotationElement */ public uk.ac.vamsas.objects.core.AnnotationElement getAnnotationElement(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _annotationElementList.size())) { throw new IndexOutOfBoundsException("getAnnotationElement: Index value '"+index+"' not in range [0.."+_annotationElementList.size()+ "]"); } return (uk.ac.vamsas.objects.core.AnnotationElement) _annotationElementList.elementAt(index); } //-- uk.ac.vamsas.objects.core.AnnotationElement getAnnotationElement(int) /** * Method getAnnotationElement * * * * @return AnnotationElement */ public uk.ac.vamsas.objects.core.AnnotationElement[] getAnnotationElement() { int size = _annotationElementList.size(); uk.ac.vamsas.objects.core.AnnotationElement[] mArray = new uk.ac.vamsas.objects.core.AnnotationElement[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.AnnotationElement) _annotationElementList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.AnnotationElement[] getAnnotationElement() /** * Method getAnnotationElementCount * * * * @return int */ public int getAnnotationElementCount() { return _annotationElementList.size(); } //-- int getAnnotationElementCount() /** * Returns the value of field 'description'. The field * 'description' has the following description: Human readable * description of the annotation * * * @return String * @return the value of field 'description'. */ public java.lang.String getDescription() { return this._description; } //-- java.lang.String getDescription() /** * Returns the value of field 'group'. The field 'group' has * the following description: Annotation with the same * non-empty group name are grouped * together * * @return String * @return the value of field 'group'. */ public java.lang.String getGroup() { return this._group; } //-- java.lang.String getGroup() /** * 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 'label'. The field 'label' has * the following description: Short, meaningful name for the * annotation - if this * is absent, then the type string should be used in its * place. * * * @return String * @return the value of field 'label'. */ public java.lang.String getLabel() { return this._label; } //-- java.lang.String getLabel() /** * 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() /** * Returns the value of field 'modifiable'. * * @return String * @return the value of field 'modifiable'. */ public java.lang.String getModifiable() { return this._modifiable; } //-- java.lang.String getModifiable() /** * 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() /** * Method getScore * * * * @param index * @return Score */ public uk.ac.vamsas.objects.core.Score getScore(int index) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _scoreList.size())) { throw new IndexOutOfBoundsException("getScore: Index value '"+index+"' not in range [0.."+_scoreList.size()+ "]"); } return (uk.ac.vamsas.objects.core.Score) _scoreList.elementAt(index); } //-- uk.ac.vamsas.objects.core.Score getScore(int) /** * Method getScore * * * * @return Score */ public uk.ac.vamsas.objects.core.Score[] getScore() { int size = _scoreList.size(); uk.ac.vamsas.objects.core.Score[] mArray = new uk.ac.vamsas.objects.core.Score[size]; for (int index = 0; index < size; index++) { mArray[index] = (uk.ac.vamsas.objects.core.Score) _scoreList.elementAt(index); } return mArray; } //-- uk.ac.vamsas.objects.core.Score[] getScore() /** * Method getScoreCount * * * * @return int */ public int getScoreCount() { return _scoreList.size(); } //-- int getScoreCount() /** * Returns the value of field 'status'. The field 'status' has * the following description: TODO: specify this - we have * considered taking the GO * evidence codes as a model for assessing a measure of * quality to an * annotation. * * @return String * @return the value of field 'status'. */ public java.lang.String getStatus() { return this._status; } //-- java.lang.String getStatus() /** * Returns the value of field 'type'. The field 'type' has the * following description: A Das Feature has both a type and a * Type ID. We go the * route of requiring the type string to be taken from a * controlled * vocabulary if an application expects others to make sense * of it. The * type may qualified - so uniprot:CHAIN is a valid type name, * and * considered distinct from someotherDB:CHAIN * * @return String * @return the value of field 'type'. */ public java.lang.String getType() { return this._type; } //-- java.lang.String getType() /** * 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 removeAllAnnotationElement * */ public void removeAllAnnotationElement() { _annotationElementList.removeAllElements(); } //-- void removeAllAnnotationElement() /** * Method removeAllLink * */ public void removeAllLink() { _linkList.removeAllElements(); } //-- void removeAllLink() /** * Method removeAllProperty * */ public void removeAllProperty() { _propertyList.removeAllElements(); } //-- void removeAllProperty() /** * Method removeAllScore * */ public void removeAllScore() { _scoreList.removeAllElements(); } //-- void removeAllScore() /** * Method removeAnnotationElement * * * * @param index * @return AnnotationElement */ public uk.ac.vamsas.objects.core.AnnotationElement removeAnnotationElement(int index) { java.lang.Object obj = _annotationElementList.elementAt(index); _annotationElementList.removeElementAt(index); return (uk.ac.vamsas.objects.core.AnnotationElement) obj; } //-- uk.ac.vamsas.objects.core.AnnotationElement removeAnnotationElement(int) /** * 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 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) /** * Method removeScore * * * * @param index * @return Score */ public uk.ac.vamsas.objects.core.Score removeScore(int index) { java.lang.Object obj = _scoreList.elementAt(index); _scoreList.removeElementAt(index); return (uk.ac.vamsas.objects.core.Score) obj; } //-- uk.ac.vamsas.objects.core.Score removeScore(int) /** * Method setAnnotationElement * * * * @param index * @param vAnnotationElement */ public void setAnnotationElement(int index, uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _annotationElementList.size())) { throw new IndexOutOfBoundsException("setAnnotationElement: Index value '"+index+"' not in range [0.."+_annotationElementList.size()+ "]"); } _annotationElementList.setElementAt(vAnnotationElement, index); } //-- void setAnnotationElement(int, uk.ac.vamsas.objects.core.AnnotationElement) /** * Method setAnnotationElement * * * * @param annotationElementArray */ public void setAnnotationElement(uk.ac.vamsas.objects.core.AnnotationElement[] annotationElementArray) { //-- copy array _annotationElementList.removeAllElements(); for (int i = 0; i < annotationElementArray.length; i++) { _annotationElementList.addElement(annotationElementArray[i]); } } //-- void setAnnotationElement(uk.ac.vamsas.objects.core.AnnotationElement) /** * Sets the value of field 'description'. The field * 'description' has the following description: Human readable * description of the annotation * * * @param description the value of field 'description'. */ public void setDescription(java.lang.String description) { this._description = description; } //-- void setDescription(java.lang.String) /** * Sets the value of field 'group'. The field 'group' has the * following description: Annotation with the same non-empty * group name are grouped * together * * @param group the value of field 'group'. */ public void setGroup(java.lang.String group) { this._group = group; } //-- void setGroup(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) /** * Sets the value of field 'label'. The field 'label' has the * following description: Short, meaningful name for the * annotation - if this * is absent, then the type string should be used in its * place. * * * @param label the value of field 'label'. */ public void setLabel(java.lang.String label) { this._label = label; } //-- void setLabel(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) /** * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; } //-- void setModifiable(java.lang.String) /** * 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) /** * Method setScore * * * * @param index * @param vScore */ public void setScore(int index, uk.ac.vamsas.objects.core.Score vScore) throws java.lang.IndexOutOfBoundsException { //-- check bounds for index if ((index < 0) || (index > _scoreList.size())) { throw new IndexOutOfBoundsException("setScore: Index value '"+index+"' not in range [0.."+_scoreList.size()+ "]"); } _scoreList.setElementAt(vScore, index); } //-- void setScore(int, uk.ac.vamsas.objects.core.Score) /** * Method setScore * * * * @param scoreArray */ public void setScore(uk.ac.vamsas.objects.core.Score[] scoreArray) { //-- copy array _scoreList.removeAllElements(); for (int i = 0; i < scoreArray.length; i++) { _scoreList.addElement(scoreArray[i]); } } //-- void setScore(uk.ac.vamsas.objects.core.Score) /** * Sets the value of field 'status'. The field 'status' has the * following description: TODO: specify this - we have * considered taking the GO * evidence codes as a model for assessing a measure of * quality to an * annotation. * * @param status the value of field 'status'. */ public void setStatus(java.lang.String status) { this._status = status; } //-- void setStatus(java.lang.String) /** * Sets the value of field 'type'. The field 'type' has the * following description: A Das Feature has both a type and a * Type ID. We go the * route of requiring the type string to be taken from a * controlled * vocabulary if an application expects others to make sense * of it. The * type may qualified - so uniprot:CHAIN is a valid type name, * and * considered distinct from someotherDB:CHAIN * * @param type the value of field 'type'. */ public void setType(java.lang.String type) { this._type = type; } //-- void setType(java.lang.String) /** * Method unmarshal * * * * @param reader * @return RangeType */ public static uk.ac.vamsas.objects.core.RangeType unmarshal(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.RangeAnnotation) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.RangeAnnotation.class, reader); } //-- uk.ac.vamsas.objects.core.RangeType 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() }