## org.biojavax
Class SimpleRankedDocRef

    java.lang.Object
      org.biojava.utils.AbstractChangeable
          org.biojavax.SimpleRankedDocRef

All Implemented Interfaces:
  Comparable, Changeable, RankedDocRef

    public class SimpleRankedDocRef

extends AbstractChangeable
implements RankedDocRef

Represents a documentary reference.

Since:
  1.5
Author:
  Richard Holland, gwaldon

Field Summary

Fields inherited from interface org.biojavax.RankedDocRef
`LOCATION, RANK`

Constructor Summary
`protected` `SimpleRankedDocRef()`
`` `SimpleRankedDocRef(DocRef docref, Integer start, Integer end, int rank)` Constructs a new docref for a given location.
`` `SimpleRankedDocRef(DocRef docref, RichLocation location, int rank)` Constructs a new docref for a given location.

Method Summary
`int` `compareTo(Object o)` Ranked document references are sorted first by rank then location then by actual document reference.
`boolean` `equals(Object obj)` Two ranked document references are equal if they have the same rank and refer to the same location and same document reference.
`DocRef` `getDocumentReference()` Represents a reference to a document.
`Integer` `getEnd()` The end position in the sequence that this reference is referred to from.
`RichLocation` `getLocation()` If this object was constructed using a location instead of two integers, then this method will return that location.
`int` `getRank()` The rank of this reference.
`Integer` `getStart()` The start position in the sequence that this reference is referred to from.
`int` `hashCode()`
`void` `setLocation(RichLocation location)` Set the location of this reference.
`void` `setRank(int rank)` Set the rank of this reference.
`String` `toString()` Form: "(#rank) docref"

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

### SimpleRankedDocRef

    public SimpleRankedDocRef(DocRef docref,
                              Integer start,
                              Integer end,
                              int rank)

  Constructs a new docref for a given location. If one or the other of start and end are null, only the non-null value is used. If both are null, no value is used for the location.

  Parameters:
    `docref` - the document reference. Must not be null.
    `start` - the start position of the location.
    `end` - the end position of the location.

### SimpleRankedDocRef

    public SimpleRankedDocRef(DocRef docref,
                              RichLocation location,
                              int rank)

  Constructs a new docref for a given location.

  Parameters:
    `docref` - the document reference. Must not be null.
    `location` - the position of the document reference. Must not be null.

### SimpleRankedDocRef

    protected SimpleRankedDocRef()

Method Detail

### setRank

    public void setRank(int rank)
                 throws ChangeVetoException

  Set the rank of this reference.

  Specified by:
    `setRank` in interface `RankedDocRef`
  Parameters:
    `rank` - the rank to use.
  Throws:
    `ChangeVetoException` - if the new rank is unacceptable.

### getRank

    public int getRank()

  The rank of this reference. This value is intended to be set by the constructor of the implementing class.

  Specified by:
    `getRank` in interface `RankedDocRef`
  Returns:
    the rank.

### getDocumentReference

    public DocRef getDocumentReference()

  Represents a reference to a document. This value is intended to be set by the constructor of the implementing class.

  Specified by:
    `getDocumentReference` in interface `RankedDocRef`
  Returns:
    the document reference.

### getStart

    public Integer getStart()

  The start position in the sequence that this reference is referred to from. This value is intended to be set by the constructor of the implementing class. The position returned is from 1 to the length of the sequence.

  Specified by:
    `getStart` in interface `RankedDocRef`
  Returns:
    the start position.

### getEnd

    public Integer getEnd()

  The end position in the sequence that this reference is referred to from. This value is intended to be set by the constructor of the implementing class. The position returned is from 1 to the length of the sequence.

  Specified by:
    `getEnd` in interface `RankedDocRef`
  Returns:
    the end position.

### setLocation

    public void setLocation(RichLocation location)
                     throws ChangeVetoException

  Set the location of this reference.

  Specified by:
    `setLocation` in interface `RankedDocRef`
  Parameters:
    `location` - the location to use.
  Throws:
    `ChangeVetoException` - if the new location is unacceptable.

### getLocation

    public RichLocation getLocation()

  Description copied from interface: `RankedDocRef`
  If this object was constructed using a location instead of two integers, then this method will return that location. The getStart() and getEnd() methods will then return the min and max of that location, using the default location position resolver to resolve them to exact positions. If this object was constructed using two integers, then this method will return a simple location whose min and max correspond to those integers.

  Specified by:
    `getLocation` in interface `RankedDocRef`
  Returns:
    the location of this reference on the sequence.

### equals

    public boolean equals(Object obj)

  Two ranked document references are equal if they have the same rank and refer to the same location and same document reference.

  Overrides:
    `equals` in class `Object`

### compareTo

    public int compareTo(Object o)

  Ranked document references are sorted first by rank then location then by actual document reference.

  Specified by:
    `compareTo` in interface `Comparable`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Form: "(#rank) docref"

  Overrides:
    `toString` in class `Object`