|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.dsi.sux4j.bits.RankSelect
public class RankSelect
A serialisation-oriented container for associated rank/select(zero) structures.
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.
| Field Summary | |
|---|---|
Rank |
rank
A rank structure, or null. |
Select |
select
A select structure, or null. |
SelectZero |
selectZero
A zero-select structure, or null. |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final Rank rank
null.
public final Select select
null.
public final SelectZero selectZero
null.
| Constructor Detail |
|---|
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 RankSelect(Rank rank,
Select select)
rank - a rank structure, or null.select - a select structure, or null.| Method Detail |
|---|
public long count()
Rank
count in interface Rankpublic long numBits()
Rank
numBits in interface RanknumBits in interface SelectnumBits in interface SelectZero
public long rank(long from,
long to)
Rank
rank in interface Rankfrom - 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 rank(long pos)
Rank
rank in interface Rankpos - a position in the bit vector.
pos.
public long rankZero(long from,
long to)
Rank
rankZero in interface Rankfrom - 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 rankZero(long pos)
Rank
rankZero in interface Rankpos - a position in the bit vector.
pos.public long select(long rank)
Select
select in interface Selectrank - a rank.
public long selectZero(long rank)
SelectZero
selectZero in interface SelectZerorank - a rank.
public BitVector bitVector()
RankNote that you are not supposed to modify the returned vector.
bitVector in interface RankbitVector in interface SelectbitVector in interface SelectZero
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||