public class RankSelect extends Object implements Rank, Select, SelectZero, Serializable
Since structures in Sux4J serialise all contained data, including, if necessary, the underlying bit vector,
serialising separately a rank and a select structure might result in storing the underlying bit
vector twice. This class provide a simple solution by allowing one-shot serialisation of
all structures related to a bit vector. As a commodity, it provides also delegate methods, albeit
the suggested usage is deserialisation and extraction of non-null structures.
| Modifier and Type | Field and Description |
|---|---|
Rank |
rank
A rank structure, or
null. |
Select |
select
A select structure, or
null. |
SelectZero |
selectZero
A zero-select structure, or
null. |
| Constructor and Description |
|---|
RankSelect(Rank rank,
Select select)
Creates a new rank/select container without zero selection using the given structures.
|
RankSelect(Rank rank,
Select select,
SelectZero selectZero)
Creates a new rank/select container using the given structures.
|
| 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 |
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.
|
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.
|
long |
select(long rank)
Returns the position of the bit of given rank.
|
long |
selectZero(long rank)
Returns the position of the bit of given rank.
|
public final Rank rank
null.public final Select select
null.public final SelectZero selectZero
null.public RankSelect(Rank rank, Select select, SelectZero selectZero)
rank - a rank structure, or null.select - a select structure, or null.selectZero - a zero-select structure, or null.public long count()
Rankpublic long numBits()
RanknumBits in interface RanknumBits in interface SelectnumBits in interface SelectZeropublic long rank(long from,
long to)
Rankpublic long rank(long pos)
Rankpublic long rankZero(long from,
long to)
Rankpublic long rankZero(long pos)
Rankpublic long select(long rank)
Selectpublic long selectZero(long rank)
SelectZeroselectZero in interface SelectZerorank - a rank.