public void build(final BuildNodeCallback callback) {

        Preconditions.checkNotNull(callback);

        if (leftChild == null) {
            callback.onLastNode(this);
            return;
        }

        LocalDate curDate = start;
        NodeInterval curChild = leftChild;
        while (curChild != null) {
            if (curChild.getStart().compareTo(curDate) > 0) {
                callback.onMissingInterval(this, curDate, curChild.getStart());
            }
            curChild.build(callback);
            // Note that skip to child endDate, meaning that we always consider the child [start end]
            curDate = curChild.getEnd();
            curChild = curChild.getRightSibling();
        }

        // Finally if there is a hole at the end, we build the missing piece from ourselves
        if (curDate.compareTo(end) < 0) {
            callback.onMissingInterval(this, curDate, end);
        }
        return;
    }
public void build ( final BuildNodeCallback callback ) { Preconditions . checkNotNull ( callback ) ; if ( leftChild == null ) { callback . onLastNode ( this ) ; return ; } LocalDate curDate = start ; NodeInterval curChild = leftChild ; while ( curChild != null ) { if ( curChild . getStart ( ) . compareTo ( curDate ) > 0 ) { callback . onMissingInterval ( this , curDate , curChild . getStart ( ) ) ; } curChild . build ( callback ) ; curDate = curChild . getEnd ( ) ; curChild = curChild . getRightSibling ( ) ; } if ( curDate . compareTo ( end ) < 0 ) { callback . onMissingInterval ( this , curDate , end ) ; } return ; }
Build the tree by calling the callback on the last node in the tree or remaining part with no children.

@param callback the callback which perform the build logic.
@return whether or not the parent NodeInterval should ignore the period covered by the child (NodeInterval)