evaluate method
Evaluates this expression according to given type and context.
Implementation
@override
dynamic evaluate(EvaluationType type, ContextModel context) {
// Interval borders should evaluate to real numbers..
final num minEval = min.evaluate(EvaluationType.REAL, context);
final num maxEval = max.evaluate(EvaluationType.REAL, context);
if (type == EvaluationType.INTERVAL) {
return Interval(minEval, maxEval);
}
if (type == EvaluationType.REAL) {
// If min == max, we can interpret an interval as real.
//TODO But should we?
if (minEval == maxEval) {
return minEval;
}
}
throw UnsupportedError('Interval $this can not be interpreted as: $type');
}