Package it.unimi.dsi.sux4j.bits
Class Rank9
- java.lang.Object
-
- it.unimi.dsi.sux4j.bits.AbstractRank
-
- it.unimi.dsi.sux4j.bits.Rank9
-
- All Implemented Interfaces:
Rank,java.io.Serializable
public class Rank9 extends AbstractRank implements Rank
Arank9implementation.rank9is a ranking structure using 25% additional space and providing exceptionally fast ranking.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description it.unimi.dsi.bits.BitVectorbitVector()Returns the bit vector indexed by this structure.longcount()Returns the number of ones in the bit vector indexed by this class.longlastOne()longnumBits()Returns the overall number of bits allocated by this structure.longrank(long pos)Returns the number of ones preceding the specified position.longrank(long from, long to)Returns the number of ones in the specified interval.longrankStrict(long pos)Returns the rank at the given position assuming that the argument is less than the length of the bit vector.-
Methods inherited from class it.unimi.dsi.sux4j.bits.AbstractRank
rankZero, rankZero
-
-
-
-
Method Detail
-
rank
public long rank(long pos)
Description copied from interface:RankReturns the number of ones preceding the specified position.
-
rankStrict
public long rankStrict(long pos)
Returns the rank at the given position assuming that the argument is less than the length of the bit vector.This method is slightly faster than
rank(long), as it avoids a check, but its behavior when the argument is equal to the length of the underlying bit vector is undefined.If the array of longs representing the bit vector has a free bit at the end, this method will work correctly even when
posis equal to the length of the bit vector.- Parameters:
pos- a position in the bit vector between 0 (inclusive) and the length of the bit vector (exclusive).- Returns:
- the number of ones preceding position
pos; ifposis out of bounds, behavior is undefined. - See Also:
rank(long)
-
numBits
public long numBits()
Description copied from interface:RankReturns the overall number of bits allocated by this structure.- Specified by:
numBitsin interfaceRank- Returns:
- the overall number of bits allocated by this structure (not including the bits of the indexed vector).
-
count
public long count()
Description copied from interface:RankReturns the number of ones in the bit vector indexed by this class.- Specified by:
countin interfaceRank- Overrides:
countin classAbstractRank- Returns:
- number of ones in the bit vector indexed by this class.
-
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- Overrides:
rankin classAbstractRank- 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.
-
lastOne
public long lastOne()
-
-