Class AtomicBitSet
java.lang.Object
dev.engine_room.flywheel.backend.util.AtomicBitSet
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAtomicBitSet(int log2SegmentSizeInBits) AtomicBitSet(int log2SegmentSizeInBits, int numBitsToPreallocate) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclear()Clear all bits to 0.voidclear(int position) voidclear(int fromIndex, int toIndex) intbooleanvoidforEachSetSpan(AtomicBitSet.BitSpanConsumer consumer) Iterate over each contiguous span of set bits.booleanget(int position) inthashCode()booleanisEmpty()longintnextClearBit(int fromIndex) intnextSetBit(int fromIndex) voidset(int position) voidset(int position, boolean value) voidset(int fromIndex, int toIndex) toBitSet()toString()
-
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
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
-
hashCode
public int hashCode() -
toBitSet
- Returns:
- a new BitSet with same bits set
-
toString
-