abstract class MinMax extends AbtractMultiParameterMathFunction {
@Override
protected Expression evaluate(List<Expression> splitParameters, ProblemsHandler problemsHandler, FunctionExpression functionCall, HiddenTokenAwareTree token) {
Iterator<Expression> expanded = expandLists(splitParameters).iterator();
Expression next = expanded.next();
while (expanded.hasNext() && next.getType()!=ASTCssNodeType.NUMBER) {
next = expanded.next();
}
if (next.getType()!=ASTCssNodeType.NUMBER) {
return new FunctionExpression(token, getName(), null);
}
NumberExpression result = (NumberExpression) next;
while (expanded.hasNext()) {
next = expanded.next();
if (next.getType()==ASTCssNodeType.NUMBER) {
NumberExpression nextNum = (NumberExpression) next;
if (!canCompare(result, nextNum)) {
problemsHandler.errorIncompatibleTypesCompared(functionCall, result.getSuffix(), nextNum.getSuffix());
return new FaultyExpression(functionCall);
}