PatternPro
|
Description:rxBitset provides a fast and compact storage medium for up to 16535 individual bit values. Individual bits within the array may be turned on or off, and tested through the simple api provided.
The entire bit array manipulated by rxBitset may be negated, added to or subtracted from using other rxBitset objects as operands in a wide variety of operations.Author:
Andrew FriedlCopyright:
1998, 1999, 2000 BlackBox Software & Consulting
General Methods
object members |
|
Bits
|
Public Property Let Bits(Index As Integer, B As Byte)
Allows setting of a block of eight bits. |
Bits
|
Public Property Get Bits(Index As Integer) As Byte
Allows a group of eight bits to be retrieved from the array. |
Bit
|
Public Property Get Bit(Index As Integer) As Boolean
Allows an individiual bit to be retrieved from the array. |
Capacity
|
Public Property Get Capacity() As Integer
A property indicating the total number of bits that may be stored in the array. |
Capacity
|
Public Property Let Capacity(C As Integer)
A property that allows the setting of the total number of bits that can be stored within the object. |
Length
|
Public Property Get Length() As Integer
The number of bytes in the internal array. |
UsedBits
|
Public Property Get UsedBits() As Integer
Returns the number of non-zero bits. |
UsedBytes
|
Public Property Get UsedBytes() As Integer
Returns the number of bytes within the internal array that are storing non-zero values. |
First
|
Public Property Get First() As Integer
Returns the index of the first bit set True. |
Equal
|
Public Function Equal(B As rxBitSet) As Boolean
Tests for bitwise equality of the bitsets. |
Clone
|
Public Function Clone() As rxBitSet
Clones the current bitset. |
ToString
|
Public Function ToString() As String
Returns a string representation of the bitset. |
ToStringX
|
Public Function ToStringX() As String
Returns a hexadecimal string representation of the bitset. |
ToStringA
|
Public Function ToStringA() As String
Returns a alphanumeric string representation of the bitset. |
IsEmpty
|
Public Function IsEmpty() As Boolean
|
IsDifferent
|
Public Function IsDifferent(B As rxBitSet) As Boolean
Tests for absolute equality of two bitsets. |
Includes
|
Public Function Includes(B As rxBitSet) As Boolean
Tests if one bitset is a subset of the current bitset. |
BSet
|
Public Sub BSet(Index As Integer)
Sets the bit at the given index to True. |
BClr
|
Public Sub BClr(Index As Integer)
Clears the bit at the given index. |
BAnd
|
Public Sub BAnd(B As rxBitSet)
"And" this bitset with another bitset. |
BOr
|
Public Sub BOr(B As rxBitSet)
"Or" this bitset with another bitset. |
BXOr
|
Public Sub BXOr(B As rxBitSet)
"XOR" this bitset with another bitset. |
FullSet
|
Public Sub FullSet(ByVal nbits As Integer)
Sets a specified number of bits True, starting with the zero bit. |
Diff
|
Public Sub Diff(B As rxBitSet)
Subtracts the bits from an operand bitset from the current bitset. |
Negate
|
Public Sub Negate()
Negates the bitset. |
General Methods - Detail
object members |
Allows setting of a block of eight bits.
Description:
This property allows the storage of a block of eight bits, (a byte) into the array of bits. If the index provided falls out of the current bounds, the array of bits will be lengthened to accomodate the new value.Definition:
Public Property Let Bits(Index As Integer, B As Byte)
Parameters: Index The index into the array where the byte is to be written. This index reflects offset into the byte array, and not the offset into the bit array. B The byte value to be stored.
Allows a group of eight bits to be retrieved from the array.
Description:
This property returns the value of a byte from the internal array from the given index. The index reflects the offset into the byte array, and not the offset into the bit array. If the Index falls outside the boundary of the byte array a zero value is returned.Definition:
Public Property Get Bits(Index As Integer) As Byte
Parameters: Index The index into the array where the byte is to be written. Returns:
A byte value containing the contents of the byte array from the index requested, or zero.
Allows an individiual bit to be retrieved from the array.
Description:
This property returns the value of a bit. The index reflects the offset into the the array of bits. If the index falls outside the boundary of the bits stored internally a zero value is returned.Definition:
Public Property Get Bit(Index As Integer) As Boolean
Parameters: Index The index into the array of the bit to be read. Returns:
A boolean value indicating the state of the bit.
A property indicating the total number of bits that may be stored in the array.
Definition:
Public Property Get Capacity() As Integer
Returns:
An integer.
A property that allows the setting of the total number of bits that can be stored within the object.
Definition:
Public Property Let Capacity(C As Integer)
Parameters: C An integer indicating the number of bits ot be stored. Returns:
An integer.
The number of bytes in the internal array.
Definition:
Public Property Get Length() As Integer
Returns the number of non-zero bits.
Definition:
Public Property Get UsedBits() As Integer
Returns:
An integer.
Returns the number of bytes within the internal array that are storing non-zero values.
Definition:
Public Property Get UsedBytes() As Integer
Returns:
An Integer count.
Returns the index of the first bit set True.
Definition:
Public Property Get First() As Integer
Returns:
An Integer index.
Tests for bitwise equality of the bitsets.
Description:
This method examines each bitset to determine if all bits set in the current bitset are also set in the operand "B".Definition:
Public Function Equal(B As rxBitSet) As Boolean
Parameters: B The bitset to be used as an operand in the operation. Returns:
True if all bits set in the operand are also set in the current bitset, otherwise False.
Clones the current bitset.
Definition:
Public Function Clone() As rxBitSet
Returns:
A rxBitset object that is bitwise equal to the current bitset.
Returns a string representation of the bitset.
Definition:
Public Function ToString() As String
Returns:
A string of ones and zeroes.
Returns a hexadecimal string representation of the bitset.
Definition:
Public Function ToStringX() As String
Returns:
A string of hexadecimal digits.
Returns a alphanumeric string representation of the bitset.
Definition:
Public Function ToStringA() As String
Returns:
A string of alpha numeric characters.
Definition:
Public Function IsEmpty() As Boolean
Tests for absolute equality of two bitsets.
Description:
This method examines each bitset to determine if all bits set in the current bitset are also set in the operand "B". Additionally this methods examines each bitset to determine if the have the same capacity.Definition:
Public Function IsDifferent(B As rxBitSet) As Boolean
Parameters: B The bitset to be used as an operand in the operation. Returns:
True if the bitsets are absolutely equal, false otherwise.
Tests if one bitset is a subset of the current bitset.
Description:
This method examines an operand bitset to determine if all bits set in the operand are also set within the current bitset.Definition:
Public Function Includes(B As rxBitSet) As Boolean
Parameters: B The bitset to be used as an operand in the operation. Returns:
True if the all the bits set in B are also set True in the current bitset, otherwise False.
Sets the bit at the given index to True.
Description:
This method causes a bit at the specified index to be set to true. If the index falls outside the current capacity of the the internal array, the array is expanded to accommodate the new value.Definition:
Public Sub BSet(Index As Integer)
Parameters: Index The offset (zero based) of the bit that is to be set true.
Clears the bit at the given index.
Description:
This method causes a bit at the specified index to be set to false. If the index falls outside the current capacity of the the internal array, the array is expanded to accommodate the new value.Definition:
Public Sub BClr(Index As Integer)
Parameters: Index The offset (zero based) of the bit that is to be set false.
"And" this bitset with another bitset.
Description:
This method combines this bitset with another bitset using the "And" operation. After the operation, only bits set true in both this and the operand bitset will remain true.Definition:
Public Sub BAnd(B As rxBitSet)
Parameters: B The bitset to be used as an operand in the operation.
"Or" this bitset with another bitset.
Description:
This method combines this bitset with another bitset using the "Or" operation. After the operation, bits set true in either this or the operand bitset will be set to a true value. If the operand bitset contains more bits than the current bitset, the current bitset will be expanded to accommodate the bits from the operand.Definition:
Public Sub BOr(B As rxBitSet)
Parameters: B The bitset to be used as an operand in the operation.
"XOR" this bitset with another bitset.
Description:
This method combines this bitset with another bitset using the "XOr" or exclusive or operation. After the operation, only those bits set true in the current or the operand but not both will remain true. If the operand bitset contains more bits than the current bitset, the current bitset will be expanded to accommodate the bits from the operand.Definition:
Public Sub BXOr(B As rxBitSet)
Parameters: B The bitset to be used as an operand in the operation.
Sets a specified number of bits True, starting with the zero bit.
Description:
This method causes all bits in the range [0,(nbits-1)] to be set true. Before setting bits however, the capacity of of the internal array is set to accommodate the number of bits needed. All pre-exisitng bit values are destroyed.Definition:
Public Sub FullSet(ByVal nbits As Integer)
Parameters: nbits The number of bites to set True.
Subtracts the bits from an operand bitset from the current bitset.
Description:
This methods examines the bits in an operand bitset and for each bit set in the operand, the corresponding bit in the current bitset is cleared.Definition:
Public Sub Diff(B As rxBitSet)
Parameters: B The bitset to be used as an operand in the operation.
Negates the bitset.
Description:
This method "flips" bits contained within the internal array. All bits set True will be set False, conversely, all False bits will be set True.Definition:
Public Sub Negate()