private static <T, N extends IntervalTreeNode<T, N>> void searchMtasTreeWithIntervalTree(
      Collection<Integer> additionalIds, IntervalItem<T, N> checkItem,
      IndexInput in, AtomicBoolean isSinglePoint,
      AtomicBoolean isStoreAdditionalId, long objectRefApproxOffset,
      AtomicLong nodeRefApproxOffset, ArrayList<IntervalItem<T, N>> checkList)
      throws IOException {
    MtasTreeItem treeItem = checkItem.mtasTreeItem;
    IntervalTreeNode<T, N> intervalTreeNode = checkItem.intervalTreeNode;
    if (intervalTreeNode.min <= treeItem.max) {
      // advance intervalTree
      while (intervalTreeNode.left > treeItem.max) {
        if (intervalTreeNode.rightChild == null) {
          if (intervalTreeNode.leftChild == null) {
            return;
          } else {
            intervalTreeNode = intervalTreeNode.leftChild;
          }
        } else if (intervalTreeNode.leftChild == null) {
          intervalTreeNode = intervalTreeNode.rightChild;
        } else {
          if (intervalTreeNode.rightChild.min > treeItem.max) {
            intervalTreeNode = intervalTreeNode.leftChild;
          } else {
            break;
          }
        }
      }
      // find intervals matching current node
      searchMtasTreeItemWithIntervalTree(additionalIds, treeItem,
          intervalTreeNode);
      // check leftChild
      if (!treeItem.leftChild.equals(treeItem.ref)) {
        MtasTreeItem treeItemLeft = getMtasTreeItem(treeItem.leftChild,
            isSinglePoint, isStoreAdditionalId, nodeRefApproxOffset, in,
            objectRefApproxOffset);
        checkList.add(new IntervalItem<T, N>(treeItemLeft, intervalTreeNode));
      }
      // check rightChild
      if (!treeItem.rightChild.equals(treeItem.ref)) {
        MtasTreeItem treeItemRight = getMtasTreeItem(treeItem.rightChild,
            isSinglePoint, isStoreAdditionalId, nodeRefApproxOffset, in,
            objectRefApproxOffset);
        checkList.add(new IntervalItem<T, N>(treeItemRight, intervalTreeNode));
      }
    }
  }
private static < T , N extends IntervalTreeNode < T , N > > void searchMtasTreeWithIntervalTree ( Collection < Integer > additionalIds , IntervalItem < T , N > checkItem , IndexInput in , AtomicBoolean isSinglePoint , AtomicBoolean isStoreAdditionalId , long objectRefApproxOffset , AtomicLong nodeRefApproxOffset , ArrayList < IntervalItem < T , N > > checkList ) throws IOException { MtasTreeItem treeItem = checkItem . mtasTreeItem ; IntervalTreeNode < T , N > intervalTreeNode = checkItem . intervalTreeNode ; if ( intervalTreeNode . min <= treeItem . max ) { while ( intervalTreeNode . left > treeItem . max ) { if ( intervalTreeNode . rightChild == null ) { if ( intervalTreeNode . leftChild == null ) { return ; } else { intervalTreeNode = intervalTreeNode . leftChild ; } } else if ( intervalTreeNode . leftChild == null ) { intervalTreeNode = intervalTreeNode . rightChild ; } else { if ( intervalTreeNode . rightChild . min > treeItem . max ) { intervalTreeNode = intervalTreeNode . leftChild ; } else { break ; } } } searchMtasTreeItemWithIntervalTree ( additionalIds , treeItem , intervalTreeNode ) ; if ( ! treeItem . leftChild . equals ( treeItem . ref ) ) { MtasTreeItem treeItemLeft = getMtasTreeItem ( treeItem . leftChild , isSinglePoint , isStoreAdditionalId , nodeRefApproxOffset , in , objectRefApproxOffset ) ; checkList . add ( new IntervalItem < T , N > ( treeItemLeft , intervalTreeNode ) ) ; } if ( ! treeItem . rightChild . equals ( treeItem . ref ) ) { MtasTreeItem treeItemRight = getMtasTreeItem ( treeItem . rightChild , isSinglePoint , isStoreAdditionalId , nodeRefApproxOffset , in , objectRefApproxOffset ) ; checkList . add ( new IntervalItem < T , N > ( treeItemRight , intervalTreeNode ) ) ; } } }
Search mtas tree with interval tree.

@param <T> the generic type
@param <N> the number type
@param additionalIds the additional ids
@param checkItem the check item
@param in the in
@param isSinglePoint the is single point
@param isStoreAdditionalId the is store additional id
@param objectRefApproxOffset the object ref approx offset
@param nodeRefApproxOffset the node ref approx offset
@param checkList the check list
@throws IOException Signals that an I/O exception has occurred.