public class SimpleSelect extends Object implements Select
This implementation uses around 13.75% additional space on evenly distributed bit arrays, and, under the same conditions, provide very fast selects. For very unevenly distributed arrays the space occupancy will grow significantly, and access time might vary wildly.
An additional bulk method makes it possible
to select several consecutive bits at high speed, if the array is reasonably uniform. This is
the typical case when this structure is backing an EliasFanoMonotoneLongBigList.
| Constructor and Description |
|---|
SimpleSelect(BitVector bitVector)
Creates a new selection structure using the specified bit vector.
|
SimpleSelect(long[] bits,
long length)
Creates a new selection structure using a bit vector specified by an array of longs and a number of bits.
|
| Modifier and Type | Method and Description |
|---|---|
BitVector |
bitVector()
Returns the bit vector indexed by this structure.
|
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.
|
long[] |
select(long rank,
long[] dest)
Performs a bulk select of consecutive ranks into a given array.
|
long[] |
select(long rank,
long[] dest,
int offset,
int length)
Performs a bulk select of consecutive ranks into a given array fragment.
|
public SimpleSelect(long[] bits,
long length)
bits - an array of longs representing a bit array.length - the number of bits to use from bits.public SimpleSelect(BitVector bitVector)
bitVector - a bit vector.public long select(long rank)
Selectpublic long[] select(long rank,
long[] dest,
int offset,
int length)
rank - the first rank to select.dest - the destination array; it will be filled with length positions of consecutive bits starting at position offset.offset - the first bit position written in dest.length - the number of bit positions in dest starting at offset.destselect(long, long[])public long[] select(long rank,
long[] dest)
rank - the first rank to select.dest - the destination array; it will be filled with position of consecutive bits.destselect(long, long[], int, int)public long numBits()
SelectnumBits in interface Select