public class Rank9 extends AbstractRank implements Rank
rank9 implementation.
rank9 is a
ranking structure using just 25% additional space
and providing exceptionally fast ranking (on an Opteron at 2800 MHz this class
ranks a million-bit array in less than 8 nanoseconds).
| Modifier and Type | Field and Description |
|---|---|
protected long[] |
bits |
protected BitVector |
bitVector |
protected long[] |
count |
protected long |
lastOne |
protected long |
numOnes |
protected int |
numWords |
| Constructor and Description |
|---|
Rank9(BitVector bitVector) |
Rank9(long[] bits,
long length) |
| Modifier and Type | Method and Description |
|---|---|
BitVector |
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.
|
rankZero, rankZeroprotected transient long[] bits
protected final BitVector bitVector
protected final long[] count
protected final int numWords
protected final long numOnes
protected final long lastOne
public Rank9(long[] bits,
long length)
public Rank9(BitVector bitVector)
public long rank(long pos)
Rankpublic long numBits()
RanknumBits in interface Rankpublic long count()
Rankcount in interface Rankcount in class AbstractRankpublic long rank(long from,
long to)
Rankrank in interface Rankrank in class AbstractRankfrom - a position in the bit vector.to - a position in the bit vector.from (inclusive) and to (exclusive); if
to is smaller than from, 0 is returned.public long lastOne()