Package org.biojavax.bio
Class SimpleBioEntryRelationship
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.bio.SimpleBioEntryRelationship
- All Implemented Interfaces:
Comparable
,Changeable
,BioEntryRelationship
Represents a relationship between two bioentries that is described by a term
and given a rank.
- Since:
- 1.5
- Author:
- Richard Holland, Mark Schreiber, George Waldon
-
Field Summary
Fields inherited from interface org.biojavax.bio.BioEntryRelationship
RANK
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimpleBioEntryRelationship
(BioEntry object, BioEntry subject, ComparableTerm term, Integer rank) Creates a new instance of SimpleBioEntryRelationship. -
Method Summary
Modifier and TypeMethodDescriptionint
A relationship is compared first by rank, then object, subject, and term.boolean
Relationships are equal if they share the same rank, object, subject and term.getId()
Gets the Hibernate ID.Returns the object of this relationship (ie. the BioEntry which this relationship starts from).getRank()
Returns the rank of this relationship.Returns the subject of this relationship (ie. the BioEntry which this relationship targets).getTerm()
Returns the term describing the relationship.int
hashCode()
void
Sets the Hibernate ID.void
Sets the rank of this relationship.toString()
Form is "(#rank) term(object,subject)"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 Details
-
SimpleBioEntryRelationship
public SimpleBioEntryRelationship(BioEntry object, BioEntry subject, ComparableTerm term, Integer rank) Creates a new instance of SimpleBioEntryRelationship. None of the parameters may be null, and all are immutable except the rank.- Parameters:
subject
- The subject bioentry.term
- The relationship term.rank
- The rank of the relationship.
-
SimpleBioEntryRelationship
protected SimpleBioEntryRelationship()
-
-
Method Details
-
setRank
Sets the rank of this relationship. The rank may be null in the database, hence the use of an Integer object here and not an int primitive.- Specified by:
setRank
in interfaceBioEntryRelationship
- Parameters:
rank
- Value of property rank.- Throws:
ChangeVetoException
- if the rank rankles.
-
getRank
Returns the rank of this relationship. The rank may be null in the database, hence the use of an Integer object here and not an int primitive.- Specified by:
getRank
in interfaceBioEntryRelationship
- Returns:
- Value of property rank.
-
getObject
Returns the object of this relationship (ie. the BioEntry which this relationship starts from). This is an immutable property set by the constructor of an instantiating class.- Specified by:
getObject
in interfaceBioEntryRelationship
- Returns:
- Value of property object.
-
getSubject
Returns the subject of this relationship (ie. the BioEntry which this relationship targets). This is an immutable property set by the constructor of an instantiating class.- Specified by:
getSubject
in interfaceBioEntryRelationship
- Returns:
- Value of property subject.
-
getTerm
Returns the term describing the relationship. This is an immutable property set by the constructor of an instantiating class.- Specified by:
getTerm
in interfaceBioEntryRelationship
- Returns:
- Value of property term.
-
compareTo
A relationship is compared first by rank, then object, subject, and term. If ranks are null, they are treated as zero for comparison's sake.- Specified by:
compareTo
in interfaceComparable
-
equals
Relationships are equal if they share the same rank, object, subject and term. If ranks are null, they are treated as zero for consistency with comparison. -
hashCode
-
toString
Form is "(#rank) term(object,subject)" -
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.
-