Interface SelectZero

All Superinterfaces:
Serializable
All Known Implementing Classes:
RankSelect, SimpleBigSelectZero, SimpleSelectZero

public interface SelectZero extends Serializable
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 calling selectZero(long). Implementations might provide assertions to check the argument for correctness.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the bit vector indexed by this structure.
    long
    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 with length positions of consecutive bits starting at position offset; must be of length greater than offset.
      offset - the first bit position written in dest.
      length - the number of bit positions in dest starting at offset.
      Returns:
      dest
      See Also:
      API Notes:
      Implementations are allowed to require that dest be of length greater than offset even if length 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).