@Override public void addAdjacentPairs( T token, Root<T> root, SortableMemory<Column> posCols, SortableMemory<Column> zeroCols, SortableMemory<Column> negCols, Node<T> partner, boolean thisIsPos, Queue<ColumnPair> adjacentPairs) throws IOException { if (root.enterIfCandidates(token, this, partner)) { if (partner instanceof Leaf) { for (int i = 0; i < children.length; i++) { final Node<T> child = children[i]; if (child != null) { child.addAdjacentPairs( token, root, posCols, zeroCols, negCols, partner, thisIsPos, adjacentPairs); } } } else { final LogLogInterNode<T> interPartner = (LogLogInterNode<T>) partner; for (int i = 0; i < children.length; i++) { final Node<T> child = children[i]; if (child != null) { for (int j = 0; j < interPartner.children.length; j++) { final Node<T> other = interPartner.children[j]; if (other != null) { child.addAdjacentPairs( token, root, posCols, zeroCols, negCols, other, thisIsPos, adjacentPairs); } } } } } root.leave(token, this, partner); } }