/** * Returns an AVLNode array with a single element (the found node) if the * node was found or with two elements if the node was not found. If the node * is not found then the nodes returned are the nodes that would preceed and * follow the node if it existed in the tree. One of the two elements is * either a leaf node or the parent of a leaf node and the other node may be * null. * * @param node the starting node. * @param comparator the comparator to use to compare a key and an AVLNode. * @param key the key. * @return the one or two element array of AVLNodes. */ public static AVLNode[] find( AVLNode node, AVLComparator comparator, long[] key ) { if (node == null) return null; if (comparator.compare(key, node) == 0) { node.incRefCount(); return new AVLNode[] {node}; } // Walk to the root. while (node.parentNode != null) { node = node.parentNode; } return findDown(node, comparator, key); }
while ((c = comparator.compare(key, node)) != 0) { if (c < 0) { if ((nextNode = node.getLeftChildNode_N()) == null) {