private void transform(Operator operatorToTransform,
                           List<ExpressionNode> children, List<Operator> operators) {
        int i = 0;
        while (i < children.size()-1) {
            boolean transformed = false;
            if (operators.get(i).equals(operatorToTransform)) {
                ExpressionNode child1 = children.get(i);
                ExpressionNode child2 = children.get(i + 1);
                if (isConstant(child1) && isConstant(child2) && hasPrecedence(operators, i)) {
                    Value evaluated = new OperationNode(child1, operators.get(i), child2).evaluate(null);
                    if ( ! evaluated.isNaN()) { // Don't replace by NaN
                        operators.remove(i);
                        children.set(i, new ConstantNode(evaluated.freeze()));
                        children.remove(i + 1);
                        transformed = true;
                    }
                }
            }
            if ( ! transformed) // try the next index
                i++;
        }
    }
Performs simple algebraic simplification of expressions

@author bratseth
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/transform/Simplifier.java