Package org.biojavax
Class SimpleCrossRef
- java.lang.Object
-
- org.biojava.utils.Unchangeable
-
- org.biojavax.SimpleCrossRef
-
- All Implemented Interfaces:
Comparable,Annotatable,Changeable,CrossRef,RichAnnotatable
public class SimpleCrossRef extends Unchangeable implements CrossRef
A basic CrossRef implementation.- Since:
- 1.5
- Author:
- Richard Holland, Mark Schreiber, George Waldon (made Unchangeable)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
-
-
Field Summary
-
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleCrossRef()SimpleCrossRef(String dbname, String accession, int version)Creates a new instance of SimpleCrossRef with the values to use for the immutable database name, accession and version.SimpleCrossRef(String dbname, String accession, Integer version)Creates a new instance of SimpleCrossRef with the values to use for the immutable database name, accession and version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o)Compares cross references first by database name, then by accession, then by version.booleanequals(Object obj)Equality is defined as having the same database name, accession and version.StringgetAccession()Returns the accession of the object that the crossref refers to.AnnotationgetAnnotation()Should return the associated annotation object.StringgetDbname()Returns the name of the database the cross reference refers to.IntegergetId()Gets the Hibernate ID.SetgetNoteSet()Returns the set of notes associated with this object.RichAnnotationgetRichAnnotation()Return the associated annotation object.intgetVersion()Returns the version of the object that the crossref refers to.inthashCode()voidsetId(Integer id)Sets the Hibernate ID.voidsetNoteSet(Set notes)Clears the notes associated with this object and replaces them with the contents of this set.StringtoString()Form: "dbname:accession.version"-
Methods inherited from class org.biojava.utils.Unchangeable
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarder
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Constructor Detail
-
SimpleCrossRef
public SimpleCrossRef(String dbname, String accession, int version)
Creates a new instance of SimpleCrossRef with the values to use for the immutable database name, accession and version.- Parameters:
dbname- the dbname for this crossref.accession- the accession for this crossref.version- the version for this crossref.
-
SimpleCrossRef
public SimpleCrossRef(String dbname, String accession, Integer version)
Creates a new instance of SimpleCrossRef with the values to use for the immutable database name, accession and version. Identical to other dbname/accession/version constructor except the version is specified as an Integer object rather than an int primitive. Will throw an exception if version is null.- Parameters:
dbname- the dbname for this crossref.accession- the accession for this crossref.version- the version for this crossref.
-
SimpleCrossRef
protected SimpleCrossRef()
-
-
Method Detail
-
getAnnotation
public Annotation getAnnotation()
Should return the associated annotation object.- Specified by:
getAnnotationin interfaceAnnotatable- Returns:
- an Annotation object, never null
-
getRichAnnotation
public RichAnnotation getRichAnnotation()
Return the associated annotation object.- Specified by:
getRichAnnotationin interfaceRichAnnotatable- Returns:
- a RichAnnotation object, never null
-
getNoteSet
public Set getNoteSet()
Returns the set of notes associated with this object. Would normally delegate call to internal RichAnnotation instance.- Specified by:
getNoteSetin interfaceRichAnnotatable- Returns:
- set a set of Note objects.
- See Also:
Note
-
setNoteSet
public void setNoteSet(Set notes)
Clears the notes associated with this object and replaces them with the contents of this set. Would normally delegate call to internal RichAnnotation instance.- Specified by:
setNoteSetin interfaceRichAnnotatable- Parameters:
notes- the set of Note objects to replace the existing ones with.- See Also:
Note
-
getAccession
public String getAccession()
Returns the accession of the object that the crossref refers to.- Specified by:
getAccessionin interfaceCrossRef- Returns:
- Value of property accession.
-
getDbname
public String getDbname()
Returns the name of the database the cross reference refers to. This would normally be a namespace name, eg. 'gb' for GenBank.
-
getVersion
public int getVersion()
Returns the version of the object that the crossref refers to.- Specified by:
getVersionin interfaceCrossRef- Returns:
- Value of property version.
-
compareTo
public int compareTo(Object o)
Compares cross references first by database name, then by accession, then by version.- Specified by:
compareToin interfaceComparable
-
equals
public boolean equals(Object obj)
Equality is defined as having the same database name, accession and version.
-
getId
public Integer getId()
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
-