LongBitSet

BitSet of fixed length (numBits), backed by accessible (.getBits) long[], accessed with a long index. Use it only if you intend to store more than 2.1B bits, otherwise you should use FixedBitSet.

Constructors

Link copied to clipboard
constructor(numBits: Long)

Creates a new LongBitSet. The internally allocated long array will be exactly the size needed to accommodate the numBits specified.

constructor(storedBits: LongArray, numBits: Long)

Creates a new LongBitSet using the provided long[] array as backing store. The storedBits array must be large enough to accommodate the numBits specified, but may be larger. In that case the 'extra' or 'ghost' bits must be clear (or they may provoke spurious side-effects)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Expert.

Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Functions

Link copied to clipboard
fun and(other: LongBitSet)

this = this AND other

Link copied to clipboard
fun andNot(other: LongBitSet)

this = this AND NOT other

Link copied to clipboard

Returns number of set bits. NOTE: this visits every long in the backing bits array, and the result is not internally cached!

Link copied to clipboard
fun clear(index: Long)

fun clear(startIndex: Long, endIndex: Long)

Clears a range of bits.

Link copied to clipboard
Link copied to clipboard
open operator override fun equals(o: Any?): Boolean

returns true if both sets have the same bits set

Link copied to clipboard
fun flip(index: Long)

Flip the bit at the provided index.

fun flip(startIndex: Long, endIndex: Long)

Flips a range of bits

Link copied to clipboard
fun get(index: Long): Boolean
Link copied to clipboard
fun getAndClear(index: Long): Boolean
Link copied to clipboard
fun getAndSet(index: Long): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

returns true if the sets have any elements in common

Link copied to clipboard
fun length(): Long

Returns the number of bits stored in this bitset.

Link copied to clipboard
fun nextSetBit(index: Long): Long

Returns the index of the first set bit starting at the index specified. -1 is returned if there are no more set bits.

Link copied to clipboard
fun or(other: LongBitSet)

this = this OR other

Link copied to clipboard
fun prevSetBit(index: Long): Long

Returns the index of the last set bit before or on the index specified. -1 is returned if there are no more set bits.

Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard

Scans the backing store to check if all bits are clear. The method is deliberately not called "isEmpty" to emphasize it is not low cost (as isEmpty usually is).

Link copied to clipboard
fun set(index: Long)

fun set(startIndex: Long, endIndex: Long)

Sets a range of bits

Link copied to clipboard
fun xor(other: LongBitSet)

this = this XOR other