org.biojavax
Class SimpleRankedCrossRef

java.lang.Object
  extended by org.biojava.utils.Unchangeable
      extended by org.biojavax.SimpleRankedCrossRef
All Implemented Interfaces:
Comparable, Changeable, RankedCrossRef

public class SimpleRankedCrossRef
extends Unchangeable
implements RankedCrossRef

Simple implementation of RankedCrossRef.

Since:
1.5
Author:
Richard Holland

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()
          
 String toString()
           Form: "(#rank) crossref"
 
Methods inherited from class org.biojava.utils.Unchangeable
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarder
 
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.

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