Rank
, Select
, SelectZero
, java.io.Serializable
public class RankSelect extends java.lang.Object implements Rank, Select, SelectZero, java.io.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. For convenience, it provides also delegate methods, albeit
the suggested usage is deserialisation and extraction of non-null
structures.
Modifier and Type | Field | Description |
---|---|---|
Rank |
rank |
A rank structure, or
null . |
Select |
select |
A select structure, or
null . |
SelectZero |
selectZero |
A zero-select structure, or
null . |
Constructor | 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 | 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 zero 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()
Rank
public long numBits()
Rank
numBits
in interface Rank
numBits
in interface Select
numBits
in interface SelectZero
public long rank(long from, long to)
Rank
public long rank(long pos)
Rank
public long rankZero(long from, long to)
Rank
public long rankZero(long pos)
Rank
public long select(long rank)
Select
public long selectZero(long rank)
SelectZero
selectZero
in interface SelectZero
rank
- a zero rank.