Package org.biojavax
Class SimpleRankedCrossRef
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.SimpleRankedCrossRef
-
- All Implemented Interfaces:
java.lang.Comparable,Changeable,RankedCrossRef
public class SimpleRankedCrossRef extends AbstractChangeable implements RankedCrossRef
Simple implementation of RankedCrossRef.- Since:
- 1.5
- Author:
- Richard Holland, gwaldon
-
-
Field Summary
-
Fields inherited from interface org.biojavax.RankedCrossRef
RANK
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleRankedCrossRef()SimpleRankedCrossRef(CrossRef crossref, int rank)Constructs a new crossref with a rank.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object o)Ranked cross references are sorted first by rank, then by cross reference.booleanequals(java.lang.Object obj)Ranked cross references are the same if they have the same rank and refer to the same cross reference (cross references are equal).CrossRefgetCrossRef()Return the cross reference associated with this object.intgetRank()Return the rank associated with the cross reference.inthashCode()voidsetRank(int rank)Set the rank associated with the cross reference.java.lang.StringtoString()Form: "(#rank) crossref"-
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
-
SimpleRankedCrossRef
public SimpleRankedCrossRef(CrossRef crossref, int rank)
Constructs a new crossref with a rank.- Parameters:
crossref- the crossref to rank. Must not be null.rank- the rank to give it.
-
SimpleRankedCrossRef
protected SimpleRankedCrossRef()
-
-
Method Detail
-
getCrossRef
public CrossRef getCrossRef()
Return the cross reference associated with this object.- Specified by:
getCrossRefin interfaceRankedCrossRef- Returns:
- a crossref object.
-
setRank
public void setRank(int rank) throws ChangeVetoExceptionSet the rank associated with the cross reference.- Specified by:
setRankin interfaceRankedCrossRef- Parameters:
rank- the rank to use.- Throws:
ChangeVetoException- if the new rank is unacceptable.
-
getRank
public int getRank()
Return the rank associated with the cross reference.- Specified by:
getRankin interfaceRankedCrossRef- Returns:
- the rank.
-
equals
public boolean equals(java.lang.Object obj)
Ranked cross references are the same if they have the same rank and refer to the same cross reference (cross references are equal).- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)
Ranked cross references are sorted first by rank, then by cross reference.- Specified by:
compareToin interfacejava.lang.Comparable
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Form: "(#rank) crossref"- Overrides:
toStringin classjava.lang.Object
-
-