Package org.neo4j.gds.core.utils.paged
Class HugeAtomicBitSet
- java.lang.Object
-
- org.neo4j.gds.core.utils.paged.HugeAtomicBitSet
-
public final class HugeAtomicBitSet extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallSet()Returns true iff all bits are set.longcardinality()Returns the number of set bits in the bit set.voidclear()Resets all bits in the bit set.voidclear(long index)Resets the bit at the given index.static HugeAtomicBitSetcreate(long size)voidflip(long index)Toggles the bit at the given index.voidforEachSetBit(java.util.function.LongConsumer consumer)Iterates the bit set in increasing order and calls the given consumer for each set bit.booleanget(long index)Returns the state of the bit at the given index.booleangetAndSet(long index)Sets a bit and returns the previous value.booleanisEmpty()Returns true iff no bit is set.static longmemoryEstimation(long size)voidset(long index)Sets the bit at the given index to true.voidset(long startIndex, long endIndex)Sets the bits from the startIndex (inclusive) to the endIndex (exclusive).longsize()Returns the number of bits in the bitset.
-
-
-
Method Detail
-
memoryEstimation
public static long memoryEstimation(long size)
-
create
public static HugeAtomicBitSet 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.
-
-