Constructor
(abstract) new ComparableEnum(name, value)
Constructor.
Name | Type | Description |
---|---|---|
name | string | the name |
value | number | the comparable value |
- Source
Extends
Members
name
Get the enum name.
- Overrides
- Source
value
Get the comparable value.
- Source
Methods
compareTo(other) → {number}
Compare two ComparableEnum objects based on their value
values.
Name | Type | Description |
---|---|---|
other | ComparableEnum | the object to compare to |
- Source
-1
if this.value
is less than other.value
, 1
if this.value
is greater than other.value
, 0
otherwise (when the values are equal)
- Type:
- number
equals(value) → {boolean}
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's name
is compared to this instance's name
.
Name | Type | Description |
---|---|---|
value | string | | the value to test |
- Overrides
- Source
true
if value
is the same as this instance's name
value
- Type:
- boolean
(static) minimumEnumSet(minEnumopt, cacheopt) → {Set.<ComparableEnum>|null}
Compute a complete set of enum values based on a minimum enum and/or set of enums.
If cache
is provided, then results computed via minAggregation
will be cached there, and subsequent calls will returned the cached result when appropriate.
Name | Type | Attributes | Description |
---|---|---|---|
minEnum | ComparableEnum | <optional> | a minimum enum value |
cache | Map.<string, Set.<ComparableEnum>> | <optional> | a cache of computed values |
- Source
the computed set, or null
if no values match
- Type:
- Set.<ComparableEnum> |
null