Class AbstractRank
java.lang.Object
it.unimi.dsi.sux4j.bits.AbstractRank
- All Implemented Interfaces:
Rank, Serializable
- Direct Known Subclasses:
Rank11, Rank11Original, Rank12, Rank16, Rank9, Rank9GogPetri, SparseRank
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcount()Returns the number of ones in the bit vector indexed by this class.longrank(long from, long to) Returns the number of ones in the specified interval.longrankZero(long pos) Returns the number of zeroes preceding the specified position.longrankZero(long from, long to) Returns the number of zeroes in the specified interval.
-
Constructor Details
-
AbstractRank
public AbstractRank()
-
-
Method Details
-
count
-
rank
public long rank(long from, long to) Description copied from interface:RankReturns the number of ones in the specified interval.- Specified by:
rankin interfaceRank- 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 tofrom.- Returns:
- the number of ones between
from(inclusive) andto(exclusive); if the parameters are out of bounds, behavior is undefined.
-
rankZero
public long rankZero(long pos) Description copied from interface:RankReturns the number of zeroes preceding the specified position. -
rankZero
public long rankZero(long from, long to) Description copied from interface:RankReturns the number of zeroes in the specified interval.- Specified by:
rankZeroin interfaceRank- 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 tofrom.- Returns:
- the number of zeros between
from(inclusive) andto(exclusive); if the parameters are out of bounds, behavior is undefined (might throw an exception).
-