Package org.neo4j.gds.core.utils.paged
Class HugeAtomicGrowingBitSet
- java.lang.Object
-
- org.neo4j.gds.core.utils.paged.HugeAtomicGrowingBitSet
-
public final class HugeAtomicGrowingBitSet extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allSet()
Returns true iff all bits are set.long
cardinality()
Returns the number of set bits in the bit set.void
clear()
Resets all bits in the bit set.void
clear(long index)
Resets the bit at the given index.static HugeAtomicGrowingBitSet
create(long size)
void
flip(long index)
Toggles the bit at the given index.void
forEachSetBit(java.util.function.LongConsumer consumer)
Iterates the bit set in increasing order and calls the given consumer for each set bit.boolean
get(long index)
Returns the state of the bit at the given index.boolean
getAndSet(long index)
Sets a bit and returns the previous value.boolean
isEmpty()
Returns true iff no bit is set.void
set(long index)
Sets the bit at the given index to true.void
set(long startIndex, long endIndex)
Sets the bits from the startIndex (inclusive) to the endIndex (exclusive).long
size()
Returns the number of bits in the bitset.
-
-
-
Method Detail
-
create
public static HugeAtomicGrowingBitSet create(long size)
-
get
public boolean get(long index)
Returns the state of the bit at the given index.
-
set
public void set(long index)
Sets the bit at the given index to true.
-
set
public void set(long startIndex, long endIndex)
Sets the bits from the startIndex (inclusive) to the endIndex (exclusive).
-
getAndSet
public boolean getAndSet(long index)
Sets a bit and returns the previous value. The index should be less than the BitSet size.
-
flip
public void flip(long index)
Toggles the bit at the given index.
-
forEachSetBit
public void forEachSetBit(java.util.function.LongConsumer consumer)
Iterates the bit set in increasing order and calls the given consumer for each set bit. This method is not thread-safe.
-
cardinality
public long cardinality()
Returns the number of set bits in the bit set.Note: this method is not thread-safe.
-
isEmpty
public boolean isEmpty()
Returns true iff no bit is set.Note: this method is not thread-safe.
-
allSet
public boolean allSet()
Returns true iff all bits are set.Note: this method is not thread-safe.
-
size
public long size()
Returns the number of bits in the bitset.
-
clear
public void clear()
Resets all bits in the bit set.Note: this method is not thread-safe.
-
clear
public void clear(long index)
Resets the bit at the given index.
-
-