private int consumeNode(ExpressionNode node, List<Double> values, ContextIndex context) {
        int beforeIndex = values.size();
        if (node instanceof IfNode ifNode) {
            int jumpValueIndex = consumeIfCondition(ifNode.getCondition(), values, context);
            values.add(0d); // jumpValue goes here after the next line
            int jumpValue = consumeNode(ifNode.getTrueExpression(), values, context) + 1;
            values.set(jumpValueIndex, (double) jumpValue);
            consumeNode(ifNode.getFalseExpression(), values, context);
        } else {
            double value = toValue(node);
            if (Math.abs(value) > GBDTNode.MAX_LEAF_VALUE) {
                throw new IllegalArgumentException("Leaf value is too large for optimization: " + value);
            }
            values.add(toValue(node));
        }
        return values.size() - beforeIndex;
    }
Recursively consume nodes into the value list Returns the number of values produced by this.
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTOptimizer.java