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

public final class BitArray extends Object implements org.apache.lucene.util.Accountable, Releasable, Writeable
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

  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • set

      public void set(long index, boolean value)
      Set or clear the indexth bit based on the specified value.
    • set

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

      public boolean getAndSet(long index)
      Set the indexth bit and return true if the bit was set already.
    • 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?
    • fill

      public void fill(long fromIndex, long toIndex, boolean value)
      Set or clear slots between fromIndex inclusive to toIndex based on value.
    • size

      public long size()
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.apache.lucene.util.Accountable
    • close

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