@Override
    public int compareTo(SpanNode o) {
        int from = getFrom();
        int otherFrom = o.getFrom();

        if (from < otherFrom) {
            return -1;
        }
        if (from > otherFrom) {
            return 1;
        }

        //so from is equal. Check to:
        int to = getTo();
        int otherTo = o.getTo();

        if (to < otherTo) {
            return -1;
        }
        if (to > otherTo) {
            return 1;
        }

        //both from and to are equal
        return 0;
    }
Compares two SpanNodes.&nbsp;Note: this class has a natural ordering that <strong>might be</strong> inconsistent with equals.
<p>
First, getFrom() is compared, and -1 or 1 is return if our getFrom() is smaller or greater that o.getFrom(), respectively.
If and only if getFrom() is equal, getTo() is compared, and  -1 or 1 is return if our getTo() is smaller or greater that o.getTo(), respectively.
In all other cases, the two SpanNodes are equal both for getFrom() and getTo(), and 0 is returned.
<p>
Note that if a subclass has overridden equals(), which is very likely, but has not overridden compareTo(), then that subclass
will have a natural ordering that is inconsistent with equals.

@param o the SpanNode to compare to
@return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
document/src/main/java/com/yahoo/document/annotation/SpanNode.java