Package org.biojavax
Class SimpleRankedDocRef
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.SimpleRankedDocRef
- All Implemented Interfaces:
Comparable
,Changeable
,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
ConstructorsModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionint
Ranked document references are sorted first by rank then location then by actual document reference.boolean
Two ranked document references are equal if they have the same rank and refer to the same location and same document reference.Represents a reference to a document.getEnd()
The end position in the sequence that this reference is referred to from.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.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.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 Details
-
SimpleRankedDocRef
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
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 Details
-
setRank
Set the rank of this reference.- Specified by:
setRank
in interfaceRankedDocRef
- Parameters:
rank
- the rank to use.- Throws:
ChangeVetoException
- if the new rank is unacceptable.
-
getRank
The rank of this reference. This value is intended to be set by the constructor of the implementing class.- Specified by:
getRank
in interfaceRankedDocRef
- Returns:
- the rank.
-
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 interfaceRankedDocRef
- Returns:
- the document reference.
-
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 interfaceRankedDocRef
- Returns:
- the start position.
-
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 interfaceRankedDocRef
- Returns:
- the end position.
-
setLocation
Set the location of this reference.- Specified by:
setLocation
in interfaceRankedDocRef
- Parameters:
location
- the location to use.- Throws:
ChangeVetoException
- if the new location is unacceptable.
-
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 interfaceRankedDocRef
- Returns:
- the location of this reference on the sequence.
-
equals
Two ranked document references are equal if they have the same rank and refer to the same location and same document reference. -
compareTo
Ranked document references are sorted first by rank then location then by actual document reference.- Specified by:
compareTo
in interfaceComparable
-
hashCode
-
toString
Form: "(#rank) docref"
-