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

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

    Fields inherited from interface org.apache.lucene.util.Accountable

    NULL_ACCOUNTABLE
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    long
     
    void
    clear(long index)
    Clear the indexth bit.
    void
     
    boolean
    get(long index)
    Is the indexth bit set?
    boolean
    getAndSet(long index)
    Set the indexth bit and return true if the bit was set already.
    long
    nextSetBit(long index)
     
    void
    or(BitArray other)
    this = this OR other
    long
     
    void
    set(long index)
    Set the indexth bit.
    long
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.lucene.util.Accountable

    getChildResources
  • 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.
    • 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?
    • 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