public void consumeAnnotations(SpanTree tree, SpanList root) {
        System.out.println("\n\nSpanList: [" + root.getFrom() + ", " + root.getTo() + "] num Children: " + root.numChildren());
        System.out.println("-------------------");
        Iterator<SpanNode> childIterator = root.childIterator();
        while (childIterator.hasNext()) {
            SpanNode node = childIterator.next();
            System.out.println("\n\nSpan Node (" + node + "): [" + node.getFrom() + ", " + node.getTo() + "] ");
            if (node instanceof AlternateSpanList) {
                parseAlternateLists(tree, (AlternateSpanList)node);
                System.out.println("---- Alternate SpanList complete ---");
            } else if (node instanceof SpanList) {
                System.out.println("Encountered another span list");
                SpanList spl = (SpanList) node;
                ListIterator<SpanNode> lli = spl.childIterator();
                while (lli.hasNext()) System.out.print(" " + lli.next() + " ");
                consumeAnnotations(tree, (SpanList) node);
            } else {
                   System.out.println("\nGetting annotations for this span node: [" + node.getFrom() + ", " + node.getTo() + "] ");
                   getAnnotationsForNode(tree, node);
            }
        }
        System.out.println("\nGetting annotations for the SpanList itself : [" + root.getFrom() + ", " + root.getTo() + "] ");
        getAnnotationsForNode(tree, root);
    }
@author <a href="mailto:mpraveen@yahoo-inc.com">Praveen Mohan</a>

This test checks if sub-trees are sorted appropriately by probability
within an alternate span list and getFrom() and getTo() are updated properly
when the trees are sorted.
document/src/test/java/com/yahoo/document/annotation/Bug4164299TestCase.java