<abstract> new BitmaskEnum(name, bitNumber)
Constructor.
Extends:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the name |
bitNumber |
number | the bit offset, starting from |
Extends
Members
-
bitmaskBitNumber
-
Get the bit offset value, starting from
1
for the least significant bit. -
bitmaskBitOffset
-
Get the bit offset value, starting from
0
for the least significant bit. -
name
-
Get the enum name.
- Inherited From:
Methods
-
<static> bitmaskValue(maskables)
-
Get a bitmask value for a set of {@code Bitmaskable} objects.
Parameters:
Name Type Description maskables
Iterable.<BitmaskEnum> the set of
BitmaskEnum
objectsReturns:
a bitmask value of all module:util~BitmaskEnum#bitmaskBitOffset() values of the given
maskables
- Type
- number
-
<static> enumForBitNumber(bitNumber, values)
-
Get a
BitmaskEnum
objects for a bit number.Parameters:
Name Type Description bitNumber
number a bit number value of the
BitmaskEnum
object to findvalues
Iterable.<BitmaskEnum> the complete set of possible
BitmaskEnum
objectsReturns:
the matching
BitmaskEnum
, ornull
- Type
- BitmaskEnum
-
<static> setForBitmask(mask, values)
-
Convert a bitmask value into a set of
BitmaskEnum
objects.Parameters:
Name Type Description mask
number a bitmask value of a set of
BitmaskEnum
objectsvalues
Iterable.<BitmaskEnum> the complete set of possible
BitmaskEnum
objectsReturns:
a set of
BitmaskEnum
objects- Type
- Set.<BitmaskEnum>
-
<static> setForBitmaskEnum(mask, clazz)
-
Convert a bitmask value into a set of {@code Bitmaskable} objects.
Parameters:
Name Type Description mask
number a bitmask value of a set of {@code Bitmaskable} objects
clazz
BitmaskEnum the class of an enumeration of
BitmaskEnum
objectsReturns:
a set of
BitmaskEnum
objects- Type
- Set.<BitmaskEnum>
-
equals(value)
-
Test if a string is equal to this enum's name.
As long as enum values are consistently obtained from the module:util~Enum.enumValues array then enum instances can be compared with
===
. If unsure, this method can be used to compare string values instead.If
value
is passed as an actual Enum instance, then if that enum is the same class as this enum it'sname
is compared to this instance'sname
.Parameters:
Name Type Description value
string | Enum the value to test
- Inherited From:
Returns:
true
ifvalue
is the same as this instance'sname
value- Type
- boolean