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 be equal if they have the same value of ordinal().

    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 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