Class DocIdBitSet

  • All Implemented Interfaces:
    Bits

    public class DocIdBitSet
    extends DocIdSet
    implements Bits
    Simple DocIdSet and DocIdSetIterator backed by a BitSet
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      DocIdBitSet​(java.util.BitSet bitSet)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Bits bits()
      Optionally provides a Bits interface for random access to matching documents.
      boolean get​(int index)
      Returns the value of the bit with the specified index.
      java.util.BitSet getBitSet()
      Returns the underlying BitSet.
      boolean isCacheable()
      This DocIdSet implementation is cacheable.
      DocIdSetIterator iterator()
      Provides a DocIdSetIterator to access the set.
      int length()
      Returns the number of bits in this set
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DocIdBitSet

        public DocIdBitSet​(java.util.BitSet bitSet)
    • Method Detail

      • bits

        public Bits bits()
        Description copied from class: DocIdSet
        Optionally provides a Bits interface for random access to matching documents.
        Overrides:
        bits in class DocIdSet
        Returns:
        null, if this DocIdSet does not support random access. In contrast to DocIdSet.iterator(), a return value of null does not imply that no documents match the filter! The default implementation does not provide random access, so you only need to implement this method if your DocIdSet can guarantee random access to every docid in O(1) time without external disk access (as Bits interface cannot throw IOException). This is generally true for bit sets like FixedBitSet, which return itself if they are used as DocIdSet.
      • isCacheable

        public boolean isCacheable()
        This DocIdSet implementation is cacheable.
        Overrides:
        isCacheable in class DocIdSet
      • getBitSet

        public java.util.BitSet getBitSet()
        Returns the underlying BitSet.
      • get

        public boolean get​(int index)
        Description copied from interface: Bits
        Returns the value of the bit with the specified index.
        Specified by:
        get in interface Bits
        Parameters:
        index - index, should be non-negative and < Bits.length(). The result of passing negative or out of bounds values is undefined by this interface, just don't do it!
        Returns:
        true if the bit is set, false otherwise.
      • length

        public int length()
        Description copied from interface: Bits
        Returns the number of bits in this set
        Specified by:
        length in interface Bits