Class BitArray

java.lang.Object
org.elasticsearch.common.util.BitArray
All Implemented Interfaces:
Closeable, AutoCloseable, Releasable

public final class BitArray extends Object implements Releasable
A bit array that is implemented using a growing LongArray created from BigArrays. The underlying long array grows lazily based on the biggest index that needs to be set.
  • Constructor Details

    • BitArray

      public BitArray(long initialSize, BigArrays bigArrays)
      Create the BitArray.
      Parameters:
      initialSize - the initial size of underlying storage expressed in bits.
  • Method Details

    • set

      public void set(long index)
      Set the indexth bit.
    • or

      public void or(BitArray other)
      this = this OR other
    • nextSetBit

      public long nextSetBit(long index)
    • cardinality

      public long cardinality()
    • clear

      public void clear(long index)
      Clear the indexth bit.
    • get

      public boolean get(long index)
      Is the indexth bit set?
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Releasable