C# Class GSF.Collections.BitArray

Provides an array of bits. Much like the native .NET implementation, however this focuses on providing a free space bit array.
Afficher le fichier Open project: GridProtectionAlliance/openHistorian Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
GetBitUnchecked ( int index ) : bool
ThrowException ( int index ) : void
ThrowException ( int index, int length ) : void
Validate ( int index ) : void
Validate ( int index, int length ) : void

Method Details

AreAllBitsCleared() public méthode

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
Résultat bool

AreAllBitsSet() public méthode

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
Résultat bool

BitArray() public méthode

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
Résultat System

ClearAll() public méthode

Clears all bits.
public ClearAll ( ) : void
Résultat void

ClearBit() public méthode

Sets the corresponding bit to false
public ClearBit ( int index ) : void
index int
Résultat void

ClearBits() public méthode

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
Résultat void

EnsureCapacity() public méthode

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
Résultat void

FindClearedBit() public méthode

Returns the index of the first bit that is cleared. -1 is returned if all bits are set.
public FindClearedBit ( ) : int
Résultat int

FindSetBit() public méthode

Returns the index of the first bit that is set. -1 is returned if all bits are set.
public FindSetBit ( ) : int
Résultat int

GetAllClearedBits() public méthode

Yields a list of all bits that are cleared.
public GetAllClearedBits ( ) : IEnumerable
Résultat IEnumerable

GetAllSetBits() public méthode

Yields a list of all bits that are set.
public GetAllSetBits ( ) : IEnumerable
Résultat IEnumerable

GetBit() public méthode

Gets the status of the corresponding bit.
public GetBit ( int index ) : bool
index int
Résultat bool

SetAll() public méthode

Sets all bits.
public SetAll ( ) : void
Résultat void

SetBit() public méthode

Sets the corresponding bit to true
public SetBit ( int index ) : void
index int
Résultat void

SetBits() public méthode

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
Résultat void

SetCapacity() public méthode

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
Résultat void

TryClearBit() public méthode

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
Résultat bool

TrySetBit() public méthode

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
Résultat bool

this() public méthode

Gets/Sets individual bits in this array.
public this ( int index ) : bool
index int the bit position to get.
Résultat bool