Class BitArray

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

public final class BitArray
extends java.lang.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 Summary

    Constructors
    Constructor Description
    BitArray​(long initialSize, BigArrays bigArrays)
    Create the BitArray.
  • Method Summary

    Modifier and Type Method Description
    long cardinality()  
    void clear​(long index)
    Clear the indexth bit.
    void close()  
    boolean get​(long index)
    Is the indexth bit set?
    long nextSetBit​(long index)  
    void or​(BitArray other)
    this = this OR other
    void set​(long index)
    Set the indexth bit.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Specified by:
      close in interface Releasable