BitFlags

BitFlags

A BitFlags instance consists of a set of predefined values, each representing a binary digit that acts as a flag to enable or disable bits in a BitSet. These values are accessible directly on the instance. A NONE property is always available on the instance.

Constructor

new BitFlags(…constantsopt)

Source:
Implements:
Parameters:
Name Type Attributes Description
constants String <optional>
<repeatable>

Members

(readonly) length :Number

Source:
Implements:
The amount of values/constants in this instance, not including 'NONE'.
Type:
  • Number

(readonly) NONE :EnumConstant

Source:
Type:

Methods

(static) deserialize(input) → {BitFlags}

Source:
Deserializes a string and returns a new instance.
Parameters:
Name Type Description
input String
Throws:
In case input could not be parsed.
Type
Error
Returns:
A new instance.
Type
BitFlags

(static) fromArray(array) → {BitFlags}

Source:
Produces a new instance from an array.
Parameters:
Name Type Description
array Array.<String>
Returns:
A new instance.
Type
BitFlags

createBitArray() → {BitArray}

Source:
Produces a BitArray instance with a length based on the amount of constants in this BitFlags instance.
Returns:
A new instance.
Type
BitArray

createBitField() → {BitField}

Source:
Produces a BitField instance with a length based on the amount of constants in this BitFlags instance.
Returns:
A new instance.
Type
BitField

forEach(callback)

Source:
Implements:
See:
Iterates through this instances' values with a callback method.
Parameters:
Name Type Description
callback EnumLikeIteratorCallback

has(value) → {Boolean}

Source:
Implements:
Checks whether a value belongs to this instance.
Parameters:
Name Type Description
value EnumConstant
Returns:
Type
Boolean

serialize() → {String}

Source:
Implements:
Serializes this instance.
Returns:
Type
String

toString() → {String}

Source:
Implements:
Gets a string representation of this instance.
Returns:
A string representation of this instance.
Type
String

values() → {Array.<EnumConstant>}

Source:
Implements:
Gets the values/constants of this instance.
Returns:
The values/constants of this instance.
Type
Array.<EnumConstant>