Package org.immutables.ordinal
Interface OrdinalValue<E extends OrdinalValue<E>>
-
- Type Parameters:
E- element type
public interface OrdinalValue<E extends OrdinalValue<E>>Objects implementing this interface has stable ordinal attribute that could be used to arrange these object among other elements of the same type. Instances of the same kind are expected to beequalif they have the same value ofordinal().In essence, this type expresses enumeration for object types that cannot be represented as Java
enums. One of the justifications of such usage is sophisticated optimizations possible with data-structures that relies on the fact that number of different values of some type is countable and limited (usually, in correspondence to the problem domain that is being modeled).- See Also:
ImmutableOrdinalSet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OrdinalDomain<E>domain()Domain that contains family of objects, arranged by ordinalintordinal()Zero based ordinal value
-
-
-
Method Detail
-
ordinal
int ordinal()
Zero based ordinal value- Returns:
- the ordinal value
-
domain
OrdinalDomain<E> domain()
Domain that contains family of objects, arranged by ordinal- Returns:
- the domain
-
-