modify(); newNode.parentNode = this; newNode.childIndex = ci;
parentNode.modify(); parentNode.block.putLong(childIndex, newId); } else {
/** * The rotate which is performed when the node is heavy on the right child's * left sub-branch. * * @param nodeR a reference to the right child. * @return the change in height of the node. * @throws IOException If an I/O error occurs. */ private int rotateRL(AVLNode nodeR) throws IOException { // First perform rotateLL on nodeR. AVLNode nodeRL = nodeR.getLeftChildNode(); int deltaHeightR = nodeR.rotateLL(nodeRL); // Adjust the balance of this node. if (deltaHeightR != 0) { modify(); block.putByte( IDX_BALANCE_B, (byte)(block.getByte(IDX_BALANCE_B) - deltaHeightR) ); } // Finally do a rotateRR on this node. int deltaHeight = deltaHeightR + rotateRR(nodeRL); nodeRL.release(); return deltaHeight; }
/** * The rotate which is performed when the node is heavy on the left child's * right sub-branch. * * @param nodeL a reference to the left child. * @return the change in height of the node. * @throws IOException If an I/O error occurs. */ private int rotateLR(AVLNode nodeL) throws IOException { // First perform rotateRR on nodeL. AVLNode nodeLR = nodeL.getRightChildNode(); int deltaHeightL = nodeL.rotateRR(nodeLR); // Adjust the balance of this node. if (deltaHeightL != 0) { modify(); block.putByte( IDX_BALANCE_B, (byte)(block.getByte(IDX_BALANCE_B) + deltaHeightL) ); } // Finally do a rotateLL on this node. int deltaHeight = deltaHeightL + rotateLL(nodeLR); nodeLR.release(); return deltaHeight; }
node.modify(); node.block.putByte(IDX_BALANCE_B, (byte) balance);
} else { AVLNode node = parentNode; node.modify(); parentNode = null; adjacentNode.modify(); adjacentNode.parentNode = parentNode; adjacentNode.leftChildNode = null; parentNode.modify(); parentNode.block.putLong(childIndex, adjacentNode.getId()); adjacentParent.modify(); adjacentParent.block.putLong( adjacentParentChildIndex, adjacentNodeChildId adjacentParent.release(); } else { adjacentNode.modify(); adjacentNode.block.putLong( adjacentParentChildIndex, adjacentNodeChildId
node.modify(); node.block.putByte(IDX_BALANCE_B, (byte) balance);