Class BitSet

    • Constructor Detail

      • BitSet

        public BitSet()
    • Method Detail

      • set

        public abstract void set​(int i)
        Set the bit at i.
      • clear

        public abstract void clear​(int i)
        Clear the bit at i.
      • clear

        public abstract void clear​(int startIndex,
                                   int endIndex)
        Clears a range of bits.
        Parameters:
        startIndex - lower index
        endIndex - one-past the last bit to clear
      • cardinality

        public abstract int cardinality()
        Return the number of bits that are set. NOTE: this method is likely to run in linear time
      • approximateCardinality

        public int approximateCardinality()
        Return an approximation of the cardinality of this set. Some implementations may trade accuracy for speed if they have the ability to estimate the cardinality of the set without iterating over all the data. The default implementation returns cardinality().
      • prevSetBit

        public abstract int prevSetBit​(int index)
        Returns the index of the last set bit before or on the index specified. -1 is returned if there are no more set bits.
      • nextSetBit

        public abstract int nextSetBit​(int index)
        Returns the index of the first set bit starting at the index specified. DocIdSetIterator.NO_MORE_DOCS is returned if there are no more set bits.
      • checkUnpositioned

        protected final void checkUnpositioned​(DocIdSetIterator iter)
        Assert that the current doc is -1.
      • or

        public void or​(DocIdSetIterator iter)
                throws IOException
        Does in-place OR of the bits provided by the iterator. The state of the iterator after this operation terminates is undefined.
        Throws:
        IOException