Package org.biojavax.ontology
Class SimpleComparableTerm
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.ontology.SimpleComparableTerm
- All Implemented Interfaces:
Comparable,Annotatable,Term,Changeable,ComparableTerm,RankedCrossRefable
A Term object that can be compared and thus sorted.
- Since:
- 1.5
- Author:
- Richard Holland
-
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
ANNOTATIONFields inherited from interface org.biojavax.ontology.ComparableTerm
DESCRIPTION, IDENTIFIER, OBSOLETE, RANKEDCROSSREF -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRankedCrossRef(RankedCrossRef crossref) Adds a ranked cross reference to the existing set.voidaddSynonym(Object synonym) Add a synonym for this term.intTerms are sorted by ontology first, then name.booleanTwo terms are equal if they are in the same ontology and share the same name.Should return the associated annotation object.Return a human-readable description of this term, or the empty string if none is available.getId()Gets the Hibernate ID.Returns the (optional) identifier associated with this term.getName()Return the name of this term.Checks to see if this term is obsolete.Return the ontology in which this term exists.Returns the set of all ranked cross references associated with an object.Object[]Return the synonyms for this term.inthashCode()voidremoveRankedCrossRef(RankedCrossRef crossref) Removes a ranked cross reference from the existing set.voidremoveSynonym(Object synonym) Remove a synonym for this term.voidsetDescription(String description) Sets the description associated with this term.voidSets the Hibernate ID.voidsetIdentifier(String identifier) Sets the (optional) identifier associated with this term.voidsetObsolete(Boolean obsolete) Sets the obsolescence flag associated with this term.voidsetRankedCrossRefs(Set rankedcrossrefs) Sets the ranked cross references associated with an object.toString()Form: "ontology:name [obsolete]" where [obsolete] is optionalMethods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Constructor Details
-
SimpleComparableTerm
protected SimpleComparableTerm()
-
-
Method Details
-
hashCode
-
equals
Two terms are equal if they are in the same ontology and share the same name. -
compareTo
Terms are sorted by ontology first, then name.- Specified by:
compareToin interfaceComparable
-
addSynonym
Add a synonym for this term. Synonyms are stored in the database as the results of a toString() operation on each synonym object. This doesn't happen until it reaches the database though, so if you are not using a database, don't worry about it.- Specified by:
addSynonymin interfaceTerm- Parameters:
synonym- the synonym
-
removeSynonym
Remove a synonym for this term.- Specified by:
removeSynonymin interfaceTerm
-
getSynonyms
Return the synonyms for this term.- Specified by:
getSynonymsin interfaceTerm- Returns:
- the synonyms
-
getRankedCrossRefs
Returns the set of all ranked cross references associated with an object. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
getRankedCrossRefsin interfaceRankedCrossRefable- Returns:
- a set of RankedCrossRef objects.
-
setRankedCrossRefs
Sets the ranked cross references associated with an object. Null will throw an exception but the empty set is fine. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.- Specified by:
setRankedCrossRefsin interfaceRankedCrossRefable- Parameters:
rankedcrossrefs- a set of RankedCrossRef objects.- Throws:
ChangeVetoException- if the set was null or any of its contents were not RankedCrossRef objects.
-
addRankedCrossRef
Adds a ranked cross reference to the existing set. If already present, this call is ignored. Null values are not acceptable.- Specified by:
addRankedCrossRefin interfaceRankedCrossRefable- Parameters:
crossref- the ranked cross reference to add.- Throws:
ChangeVetoException- if the parameter is null.
-
removeRankedCrossRef
Removes a ranked cross reference from the existing set. If not present, this call is ignored. Null values are not acceptable.- Specified by:
removeRankedCrossRefin interfaceRankedCrossRefable- Parameters:
crossref- the ranked cross reference to remove.- Throws:
ChangeVetoException- if the parameter is null.
-
getName
Return the name of this term. -
getDescription
Return a human-readable description of this term, or the empty string if none is available.- Specified by:
getDescriptionin interfaceTerm- Returns:
- the description of the term
-
setDescription
Sets the description associated with this term.- Specified by:
setDescriptionin interfaceComparableTerm- Specified by:
setDescriptionin interfaceTerm- Parameters:
description- the description to give the term. Nullable.- Throws:
ChangeVetoException- if the description is unacceptable.
-
getOntology
Return the ontology in which this term exists.- Specified by:
getOntologyin interfaceTerm- Returns:
- the ontology
-
toString
Form: "ontology:name [obsolete]" where [obsolete] is optional -
getAnnotation
Should return the associated annotation object. ALWAYS RETURNS AN EMPTY ANNOTATION OBJECT- Specified by:
getAnnotationin interfaceAnnotatable- Returns:
- an Annotation object, never null
-
getIdentifier
Returns the (optional) identifier associated with this term.- Specified by:
getIdentifierin interfaceComparableTerm- Returns:
- the string identifier.
-
setIdentifier
Sets the (optional) identifier associated with this term.- Specified by:
setIdentifierin interfaceComparableTerm- Parameters:
identifier- the identifier to give the term. Null will unset it.- Throws:
ChangeVetoException- if the identifier is unacceptable.
-
getObsolete
Checks to see if this term is obsolete. As the column in the database is nullable, this value is a Boolean object instead of a boolean simple type. Hence it may also be null.- Specified by:
getObsoletein interfaceComparableTerm- Returns:
- true if it is, false if not.
-
setObsolete
Sets the obsolescence flag associated with this term.- Specified by:
setObsoletein interfaceComparableTerm- Parameters:
obsolete- true if it is obsolete, false if not. Nullable.- Throws:
ChangeVetoException- if the change is unacceptable.
-
getId
Gets the Hibernate ID. Should be used with caution.- Returns:
- the Hibernate ID, if using Hibernate.
-
setId
Sets the Hibernate ID. Should be used with caution.- Parameters:
id- the Hibernate ID, if using Hibernate.
-