private static int calculateZStarIntervalEnd(int end, AnnotatorContext context) {
        if (!context.finalRangeUsed && end == context.intervalEnd) {
            // Extend the first interval to intervalEnd - 1 to get a second Z* interval of size 1.
            context.finalRangeUsed = true;
            return context.intervalEnd - 1;
        }
        return context.leftNodeLeaves + 1;
    }
Visits the predicate tree in depth-first order and assigns intervals for features in
{@link com.yahoo.document.predicate.FeatureSet} and {@link com.yahoo.document.predicate.FeatureRange}.
predicate-search/src/main/java/com/yahoo/search/predicate/annotator/PredicateTreeAnnotator.java