public NodeInterval findNode(final LocalDate targetDate, final SearchCallback callback) {

        Preconditions.checkNotNull(callback);
        Preconditions.checkNotNull(targetDate);

        if (targetDate.compareTo(getStart()) < 0 || targetDate.compareTo(getEnd()) > 0) {
            return null;
        }

        NodeInterval curChild = leftChild;
        while (curChild != null) {
            if (curChild.getStart().compareTo(targetDate) <= 0 && curChild.getEnd().compareTo(targetDate) >= 0) {
                if (callback.isMatch(curChild)) {
                    return curChild;
                }
                NodeInterval result = curChild.findNode(targetDate, callback);
                if (result != null) {
                    return result;
                }
            }
            curChild = curChild.getRightSibling();
        }
        return null;
    }
public NodeInterval findNode ( final LocalDate targetDate , final SearchCallback callback ) { Preconditions . checkNotNull ( callback ) ; Preconditions . checkNotNull ( targetDate ) ; if ( targetDate . compareTo ( getStart ( ) ) < 0 || targetDate . compareTo ( getEnd ( ) ) > 0 ) { return null ; } NodeInterval curChild = leftChild ; while ( curChild != null ) { if ( curChild . getStart ( ) . compareTo ( targetDate ) <= 0 && curChild . getEnd ( ) . compareTo ( targetDate ) >= 0 ) { if ( callback . isMatch ( curChild ) ) { return curChild ; } NodeInterval result = curChild . findNode ( targetDate , callback ) ; if ( result != null ) { return result ; } } curChild = curChild . getRightSibling ( ) ; } return null ; }
Return the first node satisfying the date and match callback.

@param targetDate target date for possible match nodes whose interval comprises that date
@param callback   custom logic to decide if a given node is a match
@return the found node or null if there is nothing.