Table of Contents

Class BitSet

Namespace
BelNytheraSeiche.TrieDictionary
Assembly
BelNytheraSeiche.TrieDictionary.dll

Provides a mutable bit set for efficiently building large bit vectors.

public sealed class BitSet
Inheritance
BitSet
Inherited Members

Constructors

BitSet(int)

Provides a mutable bit set for efficiently building large bit vectors.

public BitSet(int arrayAlignment = 65536)

Parameters

arrayAlignment int

The alignment size for the internal buffer chunks. Must be a power of 2. Defaults to 65536.

Properties

ArrayAlignment

Gets the alignment size used by the internal buffer.

public int ArrayAlignment { get; }

Property Value

int

Methods

Add(bool)

Adds a bit to the end of the bit set.

public void Add(bool bit)

Parameters

bit bool

The bit to add (true for 1, false for 0).

Get(int)

Gets the bit value at the specified index.

public bool Get(int index)

Parameters

index int

The zero-based index of the bit to get.

Returns

bool

The bit value (true for 1, false for 0) at the specified index.

Exceptions

ArgumentOutOfRangeException

index is less than 0 or greater than or equal to the number of bits in the set.

ToImmutable()

Creates an immutable, read-only version of this bit set.

public ImmutableBitSet ToImmutable()

Returns

ImmutableBitSet

A new ImmutableBitSet containing the current data.

ToImmutable(BitSet)

Creates an immutable, read-only version of a specified BitSet.

public static ImmutableBitSet ToImmutable(BitSet bitSet)

Parameters

bitSet BitSet

The mutable bit set to convert.

Returns

ImmutableBitSet

A new ImmutableBitSet containing the data from the provided bit set.

Exceptions

ArgumentNullException

bitSet is null.

ToRankSelect(BitSet, bool)

Creates an immutable version of a specified BitSet, optimized for high-performance Rank and Select operations.

public static RankSelectBitSet ToRankSelect(BitSet bitSet, bool createAuxDir = true)

Parameters

bitSet BitSet

The mutable bit set to convert.

createAuxDir bool

A value indicating whether to immediately create the auxiliary directories required for fast Rank and Select operations.

Returns

RankSelectBitSet

A new RankSelectBitSet containing the data from the provided bit set and pre-calculated auxiliary indexes.

Remarks

If createAuxDir is set to false, this method is very fast, but the returned RankSelectBitSet will not be ready for Rank/Select operations until its auxiliary directories are created and set via the SetAuxDir() method. If set to true (the default), the auxiliary directories are created during this call, which takes more processing time but results in a fully initialized and ready-to-use object.

Exceptions

ArgumentNullException

bitSet is null.

ToRankSelect(bool)

Creates an immutable version of a specified BitSet, optimized for high-performance Rank and Select operations.

public RankSelectBitSet ToRankSelect(bool createAuxDir = true)

Parameters

createAuxDir bool

A value indicating whether to immediately create the auxiliary directories required for fast Rank and Select operations.

Returns

RankSelectBitSet

A new RankSelectBitSet containing the data from the provided bit set and pre-calculated auxiliary indexes.

Remarks

If createAuxDir is set to false, this method is very fast, but the returned RankSelectBitSet will not be ready for Rank/Select operations until its auxiliary directories are created and set via the SetAuxDir() method. If set to true (the default), the auxiliary directories are created during this call, which takes more processing time but results in a fully initialized and ready-to-use object.