EnumType

EnumType

new EnumType(parameters)

Description:
  • Specifies a enumeration type, i.e. an unordered non-repetitive enumeration of elements.

    Extends: Type. This class extends Type, with all public methods available.

    Type parameters

    General parameter

    • name: ... The type name. Required field.
    • itemType: ... The type elements around the prototypes, used to project onto the prototypes.
      • By default, "value", means any value, and the default value is undefined.
    • values: ... The enumeration of the prototypes defining this type.
      • The first value is the default value, i.e., the value as closed as possible to an undefined value.
      • Each value is semantically projected on the item data type to guaranty the coherence of the operations.

    EnumType specification

    Syntactic projection - The syntactic projection is delegated to the item type.
    Semantic projection - The semantic projection corresponds of choosing the value of minimal distance with respect to the item type.
    Distance value - The minimal distance computation is delegated to the item type and applied on each value of value set, selecting the minimal distance.
    - The complexity order of magnitude is thus linear with respect to the enumeration length considering the item type complexity as basic operation.
    Geodesic path - The geodesic calculation is delegated to the item type.
    Comparison - The comparison is delegated to the item type.
    Bounds - The values are also the bounds for this type.
Parameters:
Name Type Description
parameters JSON | String

The type parameters.

Methods

getInterpolatedValue(value, parameters) → {Value}

Description:
  • Interpolates a value with respect to one of the enumerated prototypes.

Parameters:
Name Type Description
value JSON

The input value.

parameters JSON

The interpolation parameters.

  • p: ...: select a prototype by index between {0, P{, where P is the prototype count, otherwise it is randomly selected.
  • q: ...: select, by index, on the path between the current value and the prototype, the selected value.
    • q = 0: corresponds to the input value.
    • q = 1: corresponds to the element in the direction of the prototype, which is as close as possible to the input value.
    • q >= Q-1: corresponds to the prototype, where Q is the path length corresponding to the prototype.
  • r: ...: select (if q is not defined), by relative position, on the path between the current value and the prototype, the selected value.
  • r = 0.0: corresponds to the input value.
  • t = 1.0: corresponds to the prototype.
  • 0 < r < 1: select to an element at a relative position of the path, which is neither the current nor the prototype. Otherwise select a random value on the path.
Returns:

The interpolated value.

Type
Value