C# Класс GSF.Collections.BitArray

Provides an array of bits. Much like the native .NET implementation, however this focuses on providing a free space bit array.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AreAllBitsCleared ( int index, int length ) : bool

Determines if any of the provided bits are cleared.

AreAllBitsSet ( int index, int length ) : bool

Determines if any of the provided bits are set.

BitArray ( bool initialState, int count = BitsPerElement ) : System

Initializes BitArray.

ClearAll ( ) : void

Clears all bits.

ClearBit ( int index ) : void

Sets the corresponding bit to false

ClearBits ( int index, int length ) : void

Clears a series of bits

EnsureCapacity ( int capacity ) : void

Verifies that the BitArray has the capacity to store the provided number of elements. If not, the bit array will autogrow by a factor of 2 or at least the capacity

FindClearedBit ( ) : int

Returns the index of the first bit that is cleared. -1 is returned if all bits are set.

FindSetBit ( ) : int

Returns the index of the first bit that is set. -1 is returned if all bits are set.

GetAllClearedBits ( ) : IEnumerable

Yields a list of all bits that are cleared.

GetAllSetBits ( ) : IEnumerable

Yields a list of all bits that are set.

GetBit ( int index ) : bool

Gets the status of the corresponding bit.

SetAll ( ) : void

Sets all bits.

SetBit ( int index ) : void

Sets the corresponding bit to true

SetBits ( int index, int length ) : void

Sets a series of bits

SetCapacity ( int capacity ) : void

Increases the capacity of the bit array. Decreasing capacity is currently not supported

TryClearBit ( int index ) : bool

Sets the corresponding bit to false. Returns true if the bit state was changed.

True if the bit state was changed. False if the bit was already cleared.

TrySetBit ( int index ) : bool

Sets the corresponding bit to true. Returns true if the bit state was changed.

True if the bit state was changed. False if the bit was already set.

this ( int index ) : bool

Gets/Sets individual bits in this array.

Приватные методы

Метод Описание
GetBitUnchecked ( int index ) : bool
ThrowException ( int index ) : void
ThrowException ( int index, int length ) : void
Validate ( int index ) : void
Validate ( int index, int length ) : void

Описание методов

AreAllBitsCleared() публичный Метод

Determines if any of the provided bits are cleared.
public AreAllBitsCleared ( int index, int length ) : bool
index int the starting index
length int the length of the run
Результат bool

AreAllBitsSet() публичный Метод

Determines if any of the provided bits are set.
public AreAllBitsSet ( int index, int length ) : bool
index int the starting index
length int the length of the run
Результат bool

BitArray() публичный Метод

Initializes BitArray.
public BitArray ( bool initialState, int count = BitsPerElement ) : System
initialState bool Set to true to initial will all elements set. False to have all elements cleared.
count int The number of bit positions to support
Результат System

ClearAll() публичный Метод

Clears all bits.
public ClearAll ( ) : void
Результат void

ClearBit() публичный Метод

Sets the corresponding bit to false
public ClearBit ( int index ) : void
index int
Результат void

ClearBits() публичный Метод

Clears a series of bits
public ClearBits ( int index, int length ) : void
index int the starting index to clear
length int the length of bits
Результат void

EnsureCapacity() публичный Метод

Verifies that the BitArray has the capacity to store the provided number of elements. If not, the bit array will autogrow by a factor of 2 or at least the capacity
public EnsureCapacity ( int capacity ) : void
capacity int
Результат void

FindClearedBit() публичный Метод

Returns the index of the first bit that is cleared. -1 is returned if all bits are set.
public FindClearedBit ( ) : int
Результат int

FindSetBit() публичный Метод

Returns the index of the first bit that is set. -1 is returned if all bits are set.
public FindSetBit ( ) : int
Результат int

GetAllClearedBits() публичный Метод

Yields a list of all bits that are cleared.
public GetAllClearedBits ( ) : IEnumerable
Результат IEnumerable

GetAllSetBits() публичный Метод

Yields a list of all bits that are set.
public GetAllSetBits ( ) : IEnumerable
Результат IEnumerable

GetBit() публичный Метод

Gets the status of the corresponding bit.
public GetBit ( int index ) : bool
index int
Результат bool

SetAll() публичный Метод

Sets all bits.
public SetAll ( ) : void
Результат void

SetBit() публичный Метод

Sets the corresponding bit to true
public SetBit ( int index ) : void
index int
Результат void

SetBits() публичный Метод

Sets a series of bits
public SetBits ( int index, int length ) : void
index int the starting index to clear
length int the length of bits
Результат void

SetCapacity() публичный Метод

Increases the capacity of the bit array. Decreasing capacity is currently not supported
public SetCapacity ( int capacity ) : void
capacity int the number of bits to support
Результат void

TryClearBit() публичный Метод

Sets the corresponding bit to false. Returns true if the bit state was changed.
True if the bit state was changed. False if the bit was already cleared.
public TryClearBit ( int index ) : bool
index int
Результат bool

TrySetBit() публичный Метод

Sets the corresponding bit to true. Returns true if the bit state was changed.
True if the bit state was changed. False if the bit was already set.
public TrySetBit ( int index ) : bool
index int
Результат bool

this() публичный Метод

Gets/Sets individual bits in this array.
public this ( int index ) : bool
index int the bit position to get.
Результат bool