SparseFixedBitSet

class SparseFixedBitSet(length: Int) : BitSet

A bit set that only stores longs that have at least one bit which is set. The way it works is that the space of bits is divided into blocks of 4096 bits, which is 64 longs. Then for each block, we have:

  • a long[] which stores the non-zero longs for that block

  • a long so that bit i being set means that the i-th long of the block is non-null, and its offset in the array of longs is the number of one bits on the right of the i-th bit.

Constructors

Link copied to clipboard
constructor(length: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard
val length: Int
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open 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
open override fun cardinality(): Int

Return the number of bits that are set. NOTE: this method is likely to run in linear time

Link copied to clipboard
open override fun clear()

Clear all the bits of the set.

open override fun clear(i: Int)

Clear the bit at index i.

open override fun clear(from: Int, to: Int)

Clears a range of bits.

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

Returns the value of the bit with the specified index.

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

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

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(i: 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(it: DocIdSetIterator)

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

Link copied to clipboard
open override fun prevSetBit(i: 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
open override fun set(i: Int)

Set the bit at index i.

Link copied to clipboard
open override fun toString(): String