Package org.biojavax

Class SimpleRankedDocRef

    • 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.
    • Method Detail

      • 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.
      • 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.
      • 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