|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.AbstractChangeable
org.biojavax.ontology.SimpleComparableTriple
public class SimpleComparableTriple
Basic comparable triple, BioSQL style.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.biojava.ontology.Triple |
---|
Triple.Impl |
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable |
---|
Annotatable.AnnotationForwarder |
Field Summary |
---|
Fields inherited from interface org.biojavax.ontology.ComparableTriple |
---|
DESCRIPTOR |
Fields inherited from interface org.biojava.ontology.Term |
---|
ONTOLOGY |
Fields inherited from interface org.biojava.bio.Annotatable |
---|
ANNOTATION |
Constructor Summary | |
---|---|
protected |
SimpleComparableTriple()
|
Method Summary | |
---|---|
void |
addDescriptor(ComparableTerm desc)
Adds a descriptor. |
void |
addSynonym(Object synonym)
Add a synonym for this term. NOT IMPLEMENTED |
int |
compareTo(Object o)
Triples are sorted in order of ontology, subject, object, and finally predicate. |
boolean |
equals(Object o)
Check to see if an object is an equivalent Triple. Triples are equal only if they are from the same ontology and share the same subject, object and predicate. |
Annotation |
getAnnotation()
Should return the associated annotation object. ALWAYS RETURNS THE EMPTY ANNOTATION |
String |
getDescription()
Return a human-readable description of this term, or the empty string if none is available. ALWAYS RETURNS THE EMPTY STRING |
Set |
getDescriptors()
Returns all descriptors. Warning this method gives access to the original Collection not a copy. |
Integer |
getId()
Gets the Hibernate ID. |
String |
getName()
Return the name of this term. Returns the output of toSring() |
Term |
getObject()
Return the object term of this triple. |
Ontology |
getOntology()
Return the ontology in which this term exists. |
Term |
getPredicate()
Return a Term which defines the type of relationship between the subject and object terms. |
Term |
getSubject()
Return the subject term of this triple |
Object[] |
getSynonyms()
Return the synonyms for this term. ALWAYS RETURNS AN EMPTY LIST |
int |
hashCode()
The hashcode for a Triple. |
boolean |
removeDescriptor(ComparableTerm desc)
Removes a descriptor. |
void |
removeSynonym(Object synonym)
Remove a synonym for this term. NOT IMPLEMENTED |
void |
setDescription(String desc)
set the description of the term; does not do anything |
void |
setDescriptors(Set descriptors)
Clears the current set of descriptors and replaces it with the content of the set passed. Warning this method gives access to the original Collection not a copy. |
void |
setId(Integer id)
Sets the Hibernate ID. |
String |
toString()
Form: "ontology:predicate(subject,object)" |
Methods inherited from class org.biojava.utils.AbstractChangeable |
---|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener |
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 |
---|
protected SimpleComparableTriple()
Method Detail |
---|
public int compareTo(Object o)
compareTo
in interface Comparable
public boolean equals(Object o)
Two triples are equivalent if they have the same subject, object and predicate fields.
if (! (o instanceof Triple)) { return false; } Triple to = (Triple) o; return to.getSubject() == getSubject() && to.getObject() == getObject() && to.getPredicate() == getPredicate();If you do not implement equals in this way then you have no guarantee that your Triple objects will be found in an ontology and that they will not be duplicated. Triples are equal only if they are from the same ontology and share the same subject, object and predicate.
equals
in interface Triple
equals
in class Object
public int hashCode()
This must be implemented as:
return getSubject().hashCode() + 31 * getObject().hashCode() + 31 * 31 * getPredicate().hashCode();If you do not implement hashcode in this way then you have no guarantee that your Triple objects will be found in an ontology and that they will not be duplicated.
hashCode
in interface Triple
hashCode
in class Object
public String getName()
getName
in interface Term
public Term getSubject()
getSubject
in interface Triple
public Term getObject()
getObject
in interface Triple
public Term getPredicate()
getPredicate
in interface Triple
public void addDescriptor(ComparableTerm desc) throws IllegalArgumentException, ChangeVetoException
addDescriptor
in interface ComparableTriple
desc
- the descriptor to add.
IllegalArgumentException
- if the descriptor is missing.
ChangeVetoException
- in case of objections.public boolean removeDescriptor(ComparableTerm desc) throws IllegalArgumentException, ChangeVetoException
removeDescriptor
in interface ComparableTriple
desc
- the descriptor to remove.
IllegalArgumentException
- if the descriptor is missing.
ChangeVetoException
- in case of objections.public Set getDescriptors()
getDescriptors
in interface ComparableTriple
ComparableTerm
public void setDescriptors(Set descriptors) throws ChangeVetoException
setDescriptors
in interface ComparableTriple
descriptors
- the set of ComparableTerm descriptors to add.
ChangeVetoException
- in case of objections.ComparableTerm
public void removeSynonym(Object synonym)
removeSynonym
in interface Term
public void addSynonym(Object synonym)
addSynonym
in interface Term
synonym
- the synonympublic Object[] getSynonyms()
getSynonyms
in interface Term
public Ontology getOntology()
getOntology
in interface Term
public String getDescription()
getDescription
in interface Term
public void setDescription(String desc)
setDescription
in interface Term
public Annotation getAnnotation()
getAnnotation
in interface Annotatable
public String toString()
toString
in class Object
public Integer getId()
public void setId(Integer id)
id
- the Hibernate ID, if using Hibernate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |