private int consumeIfCondition(ExpressionNode condition, List<Double> values, ContextIndex context) {
        if (isBinaryComparison(condition)) {
            OperationNode comparison = (OperationNode)condition;
            if (comparison.operators().get(0) == Operator.smaller)
                values.add(GBDTNode.MAX_LEAF_VALUE + GBDTNode.MAX_VARIABLES*0 + getVariableIndex(comparison.children().get(0), context));
            else if (comparison.operators().get(0) == Operator.equal)
                values.add(GBDTNode.MAX_LEAF_VALUE + GBDTNode.MAX_VARIABLES*1 + getVariableIndex(comparison.children().get(0), context));
            else
                throw new IllegalArgumentException("Cannot optimize other conditions than < and ==, encountered: " + comparison.operators().get(0));
            values.add(toValue(comparison.children().get(1)));
        }
        else if (condition instanceof SetMembershipNode) {
            SetMembershipNode setMembership = (SetMembershipNode)condition;
            values.add(GBDTNode.MAX_LEAF_VALUE + GBDTNode.MAX_VARIABLES*2 + getVariableIndex(setMembership.getTestValue(),context));
            values.add((double)setMembership.getSetValues().size());
            for (ExpressionNode setElementNode : setMembership.getSetValues())
                values.add(toValue(setElementNode));
        }
        else if (condition instanceof NotNode notNode) {  // handle if inversion: !(a >= b)
            if (notNode.children().size() == 1 && notNode.children().get(0) instanceof EmbracedNode embracedNode) {
                if (embracedNode.children().size() == 1 && isBinaryComparison(embracedNode.children().get(0))) {
                    OperationNode comparison = (OperationNode)embracedNode.children().get(0);
                    if (comparison.operators().get(0) == Operator.largerOrEqual)
                        values.add(GBDTNode.MAX_LEAF_VALUE + GBDTNode.MAX_VARIABLES*3 + getVariableIndex(comparison.children().get(0), context));
                    else
                        throw new IllegalArgumentException("Cannot optimize other conditions than >=, encountered: " + comparison.operators().get(0));
                    values.add(toValue(comparison.children().get(1)));
                }
            }
        }
        else {
            throw new IllegalArgumentException("Node condition could not be optimized: " + condition);
        }

        return values.size();
    }
Consumes the if condition and return the size of the values resulting, for convenience
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTOptimizer.java