Interface SelectZero

  • All Superinterfaces:
    java.io.Serializable
    All Known Implementing Classes:
    RankSelect, SimpleBigSelectZero, SimpleSelectZero

    public interface SelectZero
    extends java.io.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:
    Select
    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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      it.unimi.dsi.bits.BitVector bitVector()
      Returns 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 Detail

      • 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:
        selectZero(long, long[])
        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:
        selectZero(long, long[], int, int)
        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

        it.unimi.dsi.bits.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).