Evaluates this expression according to given type and context.
Source
evaluate(EvaluationType type, ContextModel context) {
// Interval borders should evaluate to real numbers..
num minEval = min.evaluate(EvaluationType.REAL, context);
num maxEval = max.evaluate(EvaluationType.REAL, context);
if (type == EvaluationType.INTERVAL) {
return new 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 new UnsupportedError('Interval $this can not be interpreted as: ${type}');
}