dynamic evaluate(EvaluationType type, ContextModel context)

Evaluates this expression according to given type and context.

Source

evaluate(EvaluationType type, ContextModel context) {
  if (type == EvaluationType.REAL) {
    return value;
  }

  if (type == EvaluationType.INTERVAL) {
    // interpret number as interval
    IntervalLiteral intLit = new IntervalLiteral.fromSingle(this);
    return intLit.evaluate(type, context);
  }

  if (type == EvaluationType.VECTOR) {
    // interpret number as scalar
    return value;
  }

  throw new UnsupportedError('Number $this can not be interpreted as: ${type}');
}