/** * Gets the ParentNode attribute of the AVLNode object * * @return The ParentNode value */ public AVLNode getParentNode() { if (parentNode != null) parentNode.incRefCount(); return parentNode; }
/** * Gets the minimum node to the left of this AVLNode (the smallest node * in this subtree). The current node is not released. * * @return The node under this node containing the smallest values, or * the current node if this is the smallest. */ public AVLNode getMinNode() { incRefCount(); return getMinNode_R(); }
/** * Gets the maximum node to the right of this AVLNode (the largest node * in this subtree). The current node is not released. * * @return The node under this node containing the largest values, or * the current node if this is the largest. */ public AVLNode getMaxNode() { incRefCount(); return getMaxNode_R(); }
public Object clone() { try { GNodeTuplesImpl t = (GNodeTuplesImpl)super.clone(); t.variables = (Variable[])variables.clone(); if (t.lowAVLNode != null) { t.lowAVLNode.incRefCount(); t.objectPool.incRefCount(); t.token = use(); // Allocate a new token. if (t.avlNode != null) { t.avlNode.incRefCount(); } } return t; } catch (CloneNotSupportedException e) { throw new Error( getClass() + " doesn't support clone, which it must", e ); } }
/** * 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; }
/** * 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; }
assert node != null; node.incRefCount(); if ((nextNode = node.getLeftChildNode_N()) == null) { if (lastRightChildNode != null) { lastRightChildNode.incRefCount(); if ((nextNode = node.getRightChildNode_N()) == null) { if (lastLeftChildNode != null) { lastLeftChildNode.incRefCount();
/** * Gets the PrevNode attribute of the AVLNode object. The current node is not released. * * @return The PrevNode value */ public AVLNode getPrevNode() { AVLNode node; if ((node = getLeftChildNode()) != null) { return node.getMaxNode_R(); } node = this; while (node.childIndex == IDX_LEFT) { if ((node = node.parentNode) == null) { return null; } } node = node.parentNode; if (node != null) { node.incRefCount(); } return node; }
/** * Gets the NextNode attribute of the AVLNode object. The current node is not released. * * @return The NextNode value */ public AVLNode getNextNode() { AVLNode node; if ((node = getRightChildNode()) != null) { return node.getMinNode_R(); } node = this; while (node.childIndex == IDX_RIGHT) { if ((node = node.parentNode) == null) { return null; } } node = node.parentNode; if (node != null) { node.incRefCount(); } return node; }
/** * 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); }
/** * 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 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; }
public long getRowCount() throws TuplesException { if (!nrGNodesValid) { assert lowAVLNode != null; AVLNode n = lowAVLNode; n.incRefCount(); long count = 0; while ( n != null && ( highAVLNodeId == Block.INVALID_BLOCK_ID || n.getId() != highAVLNodeId ) ) { ++count; n = n.getNextNode_R(); } if (n != null) { n.release(); } nrGNodes = count; nrGNodesValid = true; } return nrGNodes; }
newNode.parentNode = this; newNode.childIndex = ci; incRefCount();
assert lowAVLNode != null; AVLNode n = lowAVLNode; n.incRefCount(); while ( count < 2 && n != null && (
node.incRefCount(); node.rotateL(); node.release(); node.incRefCount(); node.rotateR(); node.release();
node.incRefCount(); balance = 0; } else if (balance == -2) { node.incRefCount();
lowAVLNode.incRefCount(); avlNode = lowAVLNode;
} else { --refCount; nodeR.incRefCount();
} else { --refCount; nodeL.incRefCount();