Package it.unimi.dsi.sux4j.bits
Interface SelectZero
 All Superinterfaces:
Serializable
 All Known Implementing Classes:
RankSelect
,SimpleBigSelectZero
,SimpleSelectZero
A data structure providing zero selection over a bit array.
This interface has essentially the same specification as that of Select
, but the method
selectZero(long)
selects zeroes instead of ones. Ranking zeroes is trivial (and
trivially implemented in AbstractRank
), but selecting zeroes requires specific data
structures.
 See Also:
 API Notes:
 From Sux4J 5.2.0, the
selectZero(long)
method is no longer required to return −1 when no bit with the given rank exists. If you relied on such behavior, please test the argument before callingselectZero(long)
. Implementations might provide assertions to check the argument for correctness.

Method Summary
Modifier and TypeMethodDescriptionReturns the bit vector indexed by this structure.long
numBits()
Returns the overall number of bits allocated by this structure.long
selectZero
(long zeroRank) Returns the position of the bit of given zero rank.default long[]
selectZero
(long zeroRank, long[] dest) Performs a bulk select of consecutive zero ranks into a given array.default long[]
selectZero
(long zeroRank, long[] dest, int offset, int length) Performs a bulk select of consecutive zero ranks into a given array fragment.

Method Details

selectZero
long selectZero(long zeroRank) Returns the position of the bit of given zero rank. Equivalently, returns the greatest position that is preceded by the specified number of zeroes. Parameters:
zeroRank
 a zero rank. Returns:
 the position of the bit of given zero rank; if no such bit exists, behavior is undefined .
 API Notes:
 From Sux4J 5.2.0, this method is no longer required to return −1 when no bit with the given rank exists. If you relied on such behavior, please test the argument before calling this method. Implementations might provide assertions to check the argument for correctness.

selectZero
default long[] selectZero(long zeroRank, long[] dest, int offset, int length) Performs a bulk select of consecutive zero ranks into a given array fragment. Parameters:
zeroRank
 the first zero rank to select.dest
 the destination array; it will be filled withlength
positions of consecutive bits starting at positionoffset
; must be of length greater thanoffset
.offset
 the first bit position written indest
.length
 the number of bit positions indest
starting atoffset
. Returns:
dest
 See Also:
 API Notes:
 Implementations are allowed to require that
dest
be of length greater thanoffset
even iflength
is zero.  Implementation Specification:
 This implementation just makes multiple calls to
selectZero(long)
.

selectZero
default long[] selectZero(long zeroRank, long[] dest) Performs a bulk select of consecutive zero ranks into a given array. Parameters:
zeroRank
 the first zero rank to select.dest
 the destination array; it will be filled with position of consecutive bits. Returns:
dest
 See Also:
 API Notes:
 Implementations are allowed to require that
dest
be of length greater than zero.  Implementation Specification:
 This implementation just delegates to
selectZero(long, long[], int, int)
.

bitVector
BitVector bitVector()Returns the bit vector indexed by this structure.Note that you are not supposed to modify the returned vector.
 Returns:
 the bit vector indexed by this structure.

numBits
long numBits()Returns the overall number of bits allocated by this structure. Returns:
 the overall number of bits allocated by this structure (not including the bits of the indexed vector).
