Class AtomicBitSet

java.lang.Object
dev.engine_room.flywheel.backend.util.AtomicBitSet

public class AtomicBitSet extends Object
  • Field Details

    • DEFAULT_LOG2_SEGMENT_SIZE_IN_BITS

      public static final int DEFAULT_LOG2_SEGMENT_SIZE_IN_BITS
      See Also:
  • Constructor Details

    • AtomicBitSet

      public AtomicBitSet()
    • AtomicBitSet

      public AtomicBitSet(int log2SegmentSizeInBits)
    • AtomicBitSet

      public AtomicBitSet(int log2SegmentSizeInBits, int numBitsToPreallocate)
  • Method Details

    • set

      public void set(int position, boolean value)
    • set

      public void set(int position)
    • clear

      public void clear(int position)
    • set

      public void set(int fromIndex, int toIndex)
    • clear

      public void clear(int fromIndex, int toIndex)
    • get

      public boolean get(int position)
    • maxSetBit

      public long maxSetBit()
    • nextSetBit

      public int nextSetBit(int fromIndex)
    • nextClearBit

      public int nextClearBit(int fromIndex)
    • cardinality

      public int cardinality()
      Returns:
      the number of bits which are set in this bit set.
    • forEachSetSpan

      public void forEachSetSpan(AtomicBitSet.BitSpanConsumer consumer)
      Iterate over each contiguous span of set bits.
      Parameters:
      consumer - The consumer to accept each span.
    • currentCapacity

      public int currentCapacity()
      Returns:
      the number of bits which are currently specified by this bit set. This is the maximum value to which you might need to iterate, if you were to iterate over all bits in this set.
    • isEmpty

      public boolean isEmpty()
    • clear

      public void clear()
      Clear all bits to 0.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toBitSet

      public BitSet toBitSet()
      Returns:
      a new BitSet with same bits set
    • toString

      public String toString()
      Overrides:
      toString in class Object