Class AbstractRank

java.lang.Object
it.unimi.dsi.sux4j.bits.AbstractRank
All Implemented Interfaces:
Rank, Serializable
Direct Known Subclasses:
Rank11, Rank16, Rank9, SparseRank

public abstract class AbstractRank extends Object implements Rank
An abstract implementation of Rank providing a few obvious derived methods.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the number of ones in the bit vector indexed by this class.
    long
    rank(long from, long to)
    Returns the number of ones in the specified interval.
    long
    rankZero(long pos)
    Returns the number of zeroes preceding the specified position.
    long
    rankZero(long from, long to)
    Returns the number of zeroes in the specified interval.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface it.unimi.dsi.sux4j.bits.Rank

    bitVector, numBits, rank
  • Constructor Details

    • AbstractRank

      public AbstractRank()
  • Method Details

    • count

      public long count()
      Description copied from interface: Rank
      Returns the number of ones in the bit vector indexed by this class.
      Specified by:
      count in interface Rank
      Returns:
      number of ones in the bit vector indexed by this class.
    • rank

      public long rank(long from, long to)
      Description copied from interface: Rank
      Returns the number of ones in the specified interval.
      Specified by:
      rank in interface Rank
      Parameters:
      from - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive).
      to - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive); must be greater than or equal to from.
      Returns:
      the number of ones between from (inclusive) and to (exclusive); if the parameters are out of bounds, behavior is undefined.
    • rankZero

      public long rankZero(long pos)
      Description copied from interface: Rank
      Returns the number of zeroes preceding the specified position.
      Specified by:
      rankZero in interface Rank
      Parameters:
      pos - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive).
      Returns:
      the number of zeroes preceding pos; if pos is out of bounds, behavior is undefined.
    • rankZero

      public long rankZero(long from, long to)
      Description copied from interface: Rank
      Returns the number of zeroes in the specified interval.
      Specified by:
      rankZero in interface Rank
      Parameters:
      from - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive).
      to - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive); must be greater than or equal to from.
      Returns:
      the number of zeros between from (inclusive) and to (exclusive); if the parameters are out of bounds, behavior is undefined (might throw an exception).