Class: ComparableEnum

util~ ComparableEnum

An immutable enum-like object with an associated comparable value.

This class is essentially abstract, and must be extended by another class that overrides the inerited module:util~Enum.enumValues method.


<abstract> new ComparableEnum(name, value)

Constructor.

Extends:
Parameters:
Name Type Description
name string

the name

value number

the comparable value

Extends

Members


name

Get the enum name.

Inherited From:

value

Get the comparable value.

Methods


<static> minimumEnumSet( [minEnum] [, cache])

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.

Parameters:
Name Type Argument Description
minEnum ComparableEnum <optional>

a minimum enum value

cache Map.<string, Set.<ComparableEnum>> <optional>

a cache of computed values

Returns:

the computed set, or null if no values match

Type
Set.<ComparableEnum> | null

compareTo(other)

Compare two ComparableEnum objects based on their value values.

Parameters:
Name Type Description
other ComparableEnum

the object to compare to

Returns:

-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