FixedBitSet

BitSet of fixed length (numBits), backed by accessible (.getBits) long[], accessed with an int index, implementing Bits and DocIdSet. If you need to manage more than 2.1B bits, use LongBitSet.

Constructors

Link copied to clipboard
constructor(numBits: Int)

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

constructor(storedBits: LongArray, numBits: Int)

Creates a new FixedBitSet 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: FixedBitSet)

this = this AND other

Link copied to clipboard

fun andNot(other: FixedBitSet)

this = this AND NOT other

Link copied to clipboard
open override fun applyMask(bitSet: FixedBitSet, offset: Int)

Apply this Bits instance to the given FixedBitSet, which starts at the given offset.

Link copied to clipboard
open override fun approximateCardinality(): Int

Return an approximation of the cardinality of this set. Some implementations may trade accuracy for speed if they have the ability to estimate the cardinality of the set without iterating over all the data. The default implementation returns .cardinality.

Link copied to clipboard

Convert this instance to read-only Bits. This is useful in the case that this [ ] is returned as a Bits instance, to make sure that consumers may not get write access back by casting to a FixedBitSet. NOTE: Changes to this [ ] will be reflected on the returned Bits.

Link copied to clipboard
open override fun cardinality(): Int

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
open override fun clear()

Clear all the bits of the set.

open override fun clear(index: Int)

Clear the bit at i.

open override fun clear(startIndex: Int, endIndex: Int)

Clears a range of bits.

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

Flip the bit at the provided index.

fun flip(startIndex: Int, endIndex: Int)

Flips a range of bits

Link copied to clipboard
open override fun get(index: Int): Boolean

Returns the value of the bit with the specified index.

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

Set the bit at i, returning true if it was previously set.

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
open override fun length(): Int

Returns the number of bits in this set

Link copied to clipboard
open override fun nextSetBit(index: Int): Int

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

open override fun nextSetBit(start: Int, upperBound: Int): Int

Returns the index of the first set bit from start (inclusive) until end (exclusive). is returned if there are no more set bits.

Link copied to clipboard
open override fun or(iter: DocIdSetIterator)

Does in-place OR of the bits provided by the iterator. The state of the iterator after this operation terminates is undefined.

fun or(other: FixedBitSet)

this = this OR other

Link copied to clipboard
open override fun prevSetBit(index: Int): Int

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
open override fun set(index: Int)

Set the bit at i.

fun set(startIndex: Int, endIndex: Int)

Sets a range of bits

Link copied to clipboard

Does in-place XOR of the bits provided by the iterator.

fun xor(other: FixedBitSet)

this = this XOR other