org.biojavax
Class SimpleRankedCrossRef

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojavax.SimpleRankedCrossRef
All Implemented Interfaces:
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
protected SimpleRankedCrossRef()
           
  SimpleRankedCrossRef(CrossRef crossref, int rank)
          Constructs a new crossref with a rank.
 
Method Summary
 int compareTo(Object o)
           Ranked cross references are sorted first by rank, then by cross reference.
 boolean equals(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).
 CrossRef getCrossRef()
          Return the cross reference associated with this object.
 int getRank()
          Return the rank associated with the cross reference.
 int hashCode()
          
 void setRank(int rank)
          Set the rank associated with the cross reference.
 String toString()
           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:
getCrossRef in interface RankedCrossRef
Returns:
a crossref object.

setRank

public void setRank(int rank)
             throws ChangeVetoException
Set the rank associated with the cross reference.

Specified by:
setRank in interface RankedCrossRef
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:
getRank in interface RankedCrossRef
Returns:
the rank.

equals

public boolean equals(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:
equals in class Object

compareTo

public int compareTo(Object o)
Ranked cross references are sorted first by rank, then by cross reference.

Specified by:
compareTo in interface Comparable

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()
Form: "(#rank) crossref"

Overrides:
toString in class Object