Package it.unimi.dsi.sux4j.bits
Class Rank12
java.lang.Object
it.unimi.dsi.sux4j.bits.AbstractRank
it.unimi.dsi.sux4j.bits.Rank12
- All Implemented Interfaces:
Rank
,Serializable
A
rank12
implementation.
rank12
is a ranking structure using 3.125% additional space and providing fast ranking.
It is the natural loosening of Rank11
in which the words for superblock are doubled.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionit.unimi.dsi.bits.BitVector
Returns the bit vector indexed by this structure.long
count()
Returns the number of ones in the bit vector indexed by this class.long
lastOne()
long
numBits()
Returns the overall number of bits allocated by this structure.long
rank
(long pos) Returns the number of ones preceding the specified position.long
rank
(long from, long to) Returns the number of ones in the specified interval.Methods inherited from class it.unimi.dsi.sux4j.bits.AbstractRank
rankZero, rankZero
-
Field Details
-
bits
protected transient long[] bits -
bitVector
protected final it.unimi.dsi.bits.BitVector bitVector -
count
protected final long[] count -
numWords
protected final int numWords -
numOnes
protected final long numOnes -
lastOne
protected final long lastOne
-
-
Constructor Details
-
Rank12
public Rank12(long[] bits, long length) -
Rank12
public Rank12(it.unimi.dsi.bits.BitVector bitVector)
-
-
Method Details
-
rank
public long rank(long pos) Description copied from interface:Rank
Returns the number of ones preceding the specified position. -
numBits
public long numBits()Description copied from interface:Rank
Returns the overall number of bits allocated by this structure.- Specified by:
numBits
in 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:Rank
Returns the number of ones in the bit vector indexed by this class.- Specified by:
count
in interfaceRank
- Overrides:
count
in 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:Rank
Returns the number of ones in the specified interval.- Specified by:
rank
in interfaceRank
- Overrides:
rank
in 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() -
bitVector
public it.unimi.dsi.bits.BitVector bitVector()Description copied from interface:Rank
Returns the bit vector indexed by this structure.Note that you must not modify the returned vector.
-