code: private void depthFirstSearch(final Range<C> query, final Node node, final List<Range<C>> result, final Set<Node> visited) {
          if (node == null || visited.contains(node) || query.isEmpty()) {
              return;
          }
          if (node.left() != null && Ranges.isLessThan(query, node.center())) {
              depthFirstSearch(query, node.left(), result, visited);
          }
          else if (node.right() != null && Ranges.isGreaterThan(query, node.center())) {
              depthFirstSearch(query, node.right(), result, visited);
          }
          if (Ranges.isGreaterThan(query, node.center())) {
              for (Range<C> range : node.overlapByUpperEndpoint()) {
                  if (Ranges.intersect(range, query)) {
                      result.add(range);
                  }
                  if (Ranges.isGreaterThan(query, range.upperEndpoint())) {
                      break;
                  }
              }
          }
          else if (Ranges.isLessThan(query, node.center())) {
              for (Range<C> range : node.overlapByLowerEndpoint()) {
                  if (Ranges.intersect(range, query)) {
                      result.add(range);
                  }
                  if (Ranges.isLessThan(query, range.lowerEndpoint())) {
                      break;
                  }
              }
          }
          else {
              result.addAll(node.overlapByLowerEndpoint());
          }
          visited.add(node);
      }
docs: Depth first search.
  
  @param query query range
  @param node node
  @param result list of matching ranges
  @param visited set of visited nodes