BitSet
Stores a bit pattern to quickly test if an index is enabled / disabled.
This class can store up to 32 different values in the range [0; 31].
Usage
TypeScript
The set can be typed over an enum:
.constructor<T>() ⇒ BitSet
Template Param | Type Definition |
---|---|
T | extends number |
.disable(…bits: T[][]) ⇒ BitSet
Disable the bit at the given index.
Returns: Reference to self (for method chaining).
Param | Type | Description |
---|---|---|
bits | T[] | A spread of all the bits to disable. |
.disableAll() ⇒ BitSet
Disable all bits.
Returns: Reference to self (for method chaining).
.enable(…bits: T[][]) ⇒ BitSet
Enable the bit at the given index.
Returns: Reference to self (for method chaining).
Param | Type | Description |
---|---|---|
bits | T[] | A spread of all the bits to enable. |
.enableAll() ⇒ BitSet
Enable all bits.
Returns: Reference to self (for method chaining).
.enabled(bit: T) ⇒ boolean
Checker whether the bit is set or not.
Returns: true
if it’s enabled, false
otherwise.
Param | Type | Description |
---|---|---|
bit | T | The bit to check. |