/** * Returns the left child node or null if there is no left child node. The * current node is released if and only if there is a left child node. * * @return the left child node or null if there is no left child node. */ private AVLNode getLeftChildNode_N() { AVLNode node = leftChildNode; if (node != null) { assert refCount > 1; assert node.parentNode == this; assert node.getId() == getLeftId(); node.incRefCount(); --refCount; return node; } assert refCount > 0; node = getChildNode_N(IDX_LEFT); leftChildNode = node; return node; }
/** * Returns the right child node or null if there is no right child node. The * current node is released if and only if there is a right child node. * * @return the right child node or null if there is no right child node. */ private AVLNode getRightChildNode_N() { AVLNode node = rightChildNode; if (node != null) { assert refCount > 1; assert node.parentNode == this; assert node.getId() == getRightId(); node.incRefCount(); --refCount; return node; } assert refCount > 0; node = getChildNode_N(IDX_RIGHT); rightChildNode = node; return node; }
/** * Returns the right child node or null if there is no right child node. The * current node is not released. * * @return the right child node or null if there is no right child node. */ public AVLNode getRightChildNode() { assert refCount > 0; AVLNode node = rightChildNode; if (node != null) { assert node.parentNode == this; assert node.getId() == getRightId(); node.incRefCount(); return node; } node = getChildNode_N(IDX_RIGHT); rightChildNode = node; if (node != null) { incRefCount(); } return node; }
/** * Returns the left child node or null if there is no left child node. The * current node is not released. * * @return the left child node or null if there is no left child node. */ public AVLNode getLeftChildNode() { assert refCount > 0; AVLNode node = leftChildNode; if (node != null) { assert node.parentNode == this; assert node.getId() == getLeftId(); node.incRefCount(); return node; } node = getChildNode_N(IDX_LEFT); leftChildNode = node; if (node != null) { incRefCount(); } return node; }