public class SparseSelect extends EliasFanoMonotoneLongBigList implements Select
Instances of this classes do not add support to a bit vector: rather, they replace the bit vector with a succinct representation of the positions of the ones in the bit vector.
Note that some data may be shared with SparseRank: just use the factory method SparseRank.getSelect() to obtain an instance. In that
case, numBits() counts just the new data used to build the class, and not the shared part.
AbstractLongBigList.LongSubList| Modifier and Type | Field and Description |
|---|---|
protected boolean |
fromRank
Whether this structure was built from a
SparseRank structure, and thus shares part of its internal state. |
l, length, lowerBits, selectUpper| Modifier | Constructor and Description |
|---|---|
|
SparseSelect(BitVector bitVector)
Creates a new select structure using a bit vector.
|
|
SparseSelect(long[] bits,
long length)
Creates a new select structure using a long array.
|
|
SparseSelect(LongBigList list)
Creates a new select structure using a big list of longs.
|
|
SparseSelect(LongList list)
Creates a new select structure using a list of longs.
|
protected |
SparseSelect(long n,
long m,
int l,
long[] lowerBits,
SimpleSelect selectUpper) |
|
SparseSelect(long n,
long m,
LongIterator iterator)
Creates a new select structure using an iterator.
|
| Modifier and Type | Method and Description |
|---|---|
BitVector |
bitVector()
Returns the bit vector indexed; since the bits are not stored in this data structure,
a copy is built on purpose and returned.
|
boolean |
equals(Object o) |
long |
getLong(long pos) |
SparseRank |
getRank()
Creates a new
SparseRank structure sharing data with this instance. |
int |
hashCode() |
long |
numBits()
Returns the overall number of bits allocated by this structure.
|
long |
select(long rank)
Returns the position of the bit of given rank.
|
int |
size()
Deprecated.
|
long |
size64() |
String |
toString() |
lengthadd, add, add, addAll, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, get, getElements, getLong, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, listIterator, peek, peekLong, pop, popLong, push, push, rem, remove, remove, removeElements, removeLong, removeLong, set, set, set, size, size, subList, top, topLongadd, contains, containsAll, containsAll, isEmpty, longIterator, rem, remove, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArrayclearclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, longIterator, removeAll, retainAll, toArray, toArray, toLongArray, toLongArrayadd, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArrayprotected final boolean fromRank
SparseRank structure, and thus shares part of its internal state.public SparseSelect(long[] bits,
long length)
The resulting structure keeps no reference to the original array.
bits - a long array containing the bits.length - the number of valid bits in bits.public SparseSelect(BitVector bitVector)
The resulting structure keeps no reference to the original bit vector.
bitVector - the input bit vector.public SparseSelect(long n,
long m,
LongIterator iterator)
This constructor is particularly useful if the positions of the ones are provided by some sequential source.
n - the number of bits in the underlying bit vector.m - the number of ones in the underlying bit vector.iterator - an iterator returning the positions of the ones in the underlying bit vector in increasing order.public SparseSelect(LongList list)
list - the list of the positions of ones.public SparseSelect(LongBigList list)
This constructor is particularly useful if the positions of the ones are provided by some sequential source.
list - the list of the positions of ones.protected SparseSelect(long n,
long m,
int l,
long[] lowerBits,
SimpleSelect selectUpper)
public SparseRank getRank()
SparseRank structure sharing data with this instance.SparseRank structure sharing data with this instance.public long size64()
size64 in interface Size64size64 in class EliasFanoMonotoneLongBigList@Deprecated public int size()
size in interface Size64size in interface Collection<Long>size in class AbstractLongBigListpublic long getLong(long pos)
getLong in interface LongBigListgetLong in class EliasFanoMonotoneLongBigListpublic long numBits()
SelectnumBits in interface SelectnumBits in class EliasFanoMonotoneLongBigListpublic long select(long rank)
Selectpublic BitVector bitVector()
public int hashCode()
hashCode in interface Collection<Long>hashCode in class AbstractLongBigListpublic boolean equals(Object o)
equals in interface Collection<Long>equals in class AbstractLongBigListpublic String toString()
toString in class AbstractLongBigList