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
arrayAlignmentintThe 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
Methods
Add(bool)
Adds a bit to the end of the bit set.
public void Add(bool bit)
Parameters
bitboolThe bit to add (
truefor 1,falsefor 0).
Get(int)
Gets the bit value at the specified index.
public bool Get(int index)
Parameters
indexintThe zero-based index of the bit to get.
Returns
- bool
The bit value (
truefor 1,falsefor 0) at the specified index.
Exceptions
- ArgumentOutOfRangeException
indexis 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
bitSetBitSetThe mutable bit set to convert.
Returns
- ImmutableBitSet
A new ImmutableBitSet containing the data from the provided bit set.
Exceptions
- ArgumentNullException
bitSetis 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
bitSetBitSetThe mutable bit set to convert.
createAuxDirboolA 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
bitSetis 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
createAuxDirboolA 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.