private static Object[] rotateLeft(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] leftNeighbour = (Object[]) node[keyEnd + i - 1]; final int leftNeighbourEndKey = BTree.getKeyEnd(leftNeighbour); final boolean leaves = BTree.isLeaf(nextNode); final Object[] newChild = leaves ? null : (Object[]) leftNeighbour[BTree.getChildEnd(leftNeighbour) - 1]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, 0, node[i - 1], 0, newChild); node[i - 1] = leftNeighbour[leftNeighbourEndKey - 1]; node[keyEnd + i - 1] = copyWithKeyAndChildRemoved(leftNeighbour, leftNeighbourEndKey - 1, leftNeighbourEndKey, true); BTree.getSizeMap(node)[i - 1] -= leaves ? 1 : 1 + BTree.getSizeMap(newNextNode)[0]; return newNextNode; }
private static Object[] rotateLeft(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] leftNeighbour = (Object[]) node[keyEnd + i - 1]; final int leftNeighbourEndKey = BTree.getKeyEnd(leftNeighbour); final boolean leaves = BTree.isLeaf(nextNode); final Object[] newChild = leaves ? null : (Object[]) leftNeighbour[BTree.getChildEnd(leftNeighbour) - 1]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, 0, node[i - 1], 0, newChild); node[i - 1] = leftNeighbour[leftNeighbourEndKey - 1]; node[keyEnd + i - 1] = copyWithKeyAndChildRemoved(leftNeighbour, leftNeighbourEndKey - 1, leftNeighbourEndKey, true); BTree.getSizeMap(node)[i - 1] -= leaves ? 1 : 1 + BTree.getSizeMap(newNextNode)[0]; return newNextNode; }
private static Object[] rotateLeft(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] leftNeighbour = (Object[]) node[keyEnd + i - 1]; final int leftNeighbourEndKey = BTree.getKeyEnd(leftNeighbour); final boolean leaves = BTree.isLeaf(nextNode); final Object[] newChild = leaves ? null : (Object[]) leftNeighbour[BTree.getChildEnd(leftNeighbour) - 1]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, 0, node[i - 1], 0, newChild); node[i - 1] = leftNeighbour[leftNeighbourEndKey - 1]; node[keyEnd + i - 1] = copyWithKeyAndChildRemoved(leftNeighbour, leftNeighbourEndKey - 1, leftNeighbourEndKey, true); BTree.getSizeMap(node)[i - 1] -= leaves ? 1 : 1 + BTree.getSizeMap(newNextNode)[0]; return newNextNode; }
private static Object[] rotateLeft(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] leftNeighbour = (Object[]) node[keyEnd + i - 1]; final int leftNeighbourEndKey = BTree.getKeyEnd(leftNeighbour); final boolean leaves = BTree.isLeaf(nextNode); final Object[] newChild = leaves ? null : (Object[]) leftNeighbour[BTree.getChildEnd(leftNeighbour) - 1]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, 0, node[i - 1], 0, newChild); node[i - 1] = leftNeighbour[leftNeighbourEndKey - 1]; node[keyEnd + i - 1] = copyWithKeyAndChildRemoved(leftNeighbour, leftNeighbourEndKey - 1, leftNeighbourEndKey, true); BTree.getSizeMap(node)[i - 1] -= leaves ? 1 : 1 + BTree.getSizeMap(newNextNode)[0]; return newNextNode; }
private static Object[] rotateRight(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] rightNeighbour = (Object[]) node[keyEnd + i + 1]; final boolean leaves = BTree.isLeaf(nextNode); final int nextKeyEnd = BTree.getKeyEnd(nextNode); final Object[] newChild = leaves ? null : (Object[]) rightNeighbour[BTree.getChildStart(rightNeighbour)]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, nextKeyEnd, node[i], BTree.getChildCount(nextNode), newChild); node[i] = rightNeighbour[0]; node[keyEnd + i + 1] = copyWithKeyAndChildRemoved(rightNeighbour, 0, 0, true); BTree.getSizeMap(node)[i] += leaves ? 1 : 1 + BTree.size((Object[]) newNextNode[BTree.getChildEnd(newNextNode) - 1]); return newNextNode; }
private static Object[] rotateRight(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] rightNeighbour = (Object[]) node[keyEnd + i + 1]; final boolean leaves = BTree.isLeaf(nextNode); final int nextKeyEnd = BTree.getKeyEnd(nextNode); final Object[] newChild = leaves ? null : (Object[]) rightNeighbour[BTree.getChildStart(rightNeighbour)]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, nextKeyEnd, node[i], BTree.getChildCount(nextNode), newChild); node[i] = rightNeighbour[0]; node[keyEnd + i + 1] = copyWithKeyAndChildRemoved(rightNeighbour, 0, 0, true); BTree.getSizeMap(node)[i] += leaves ? 1 : 1 + BTree.size((Object[]) newNextNode[BTree.getChildEnd(newNextNode) - 1]); return newNextNode; }
private static Object[] rotateRight(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] rightNeighbour = (Object[]) node[keyEnd + i + 1]; final boolean leaves = BTree.isLeaf(nextNode); final int nextKeyEnd = BTree.getKeyEnd(nextNode); final Object[] newChild = leaves ? null : (Object[]) rightNeighbour[BTree.getChildStart(rightNeighbour)]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, nextKeyEnd, node[i], BTree.getChildCount(nextNode), newChild); node[i] = rightNeighbour[0]; node[keyEnd + i + 1] = copyWithKeyAndChildRemoved(rightNeighbour, 0, 0, true); BTree.getSizeMap(node)[i] += leaves ? 1 : 1 + BTree.size((Object[]) newNextNode[BTree.getChildEnd(newNextNode) - 1]); return newNextNode; }
private static Object[] rotateRight(final Object[] node, final int i) { final int keyEnd = BTree.getBranchKeyEnd(node); final Object[] nextNode = (Object[]) node[keyEnd + i]; final Object[] rightNeighbour = (Object[]) node[keyEnd + i + 1]; final boolean leaves = BTree.isLeaf(nextNode); final int nextKeyEnd = BTree.getKeyEnd(nextNode); final Object[] newChild = leaves ? null : (Object[]) rightNeighbour[BTree.getChildStart(rightNeighbour)]; final Object[] newNextNode = copyWithKeyAndChildInserted(nextNode, nextKeyEnd, node[i], BTree.getChildCount(nextNode), newChild); node[i] = rightNeighbour[0]; node[keyEnd + i + 1] = copyWithKeyAndChildRemoved(rightNeighbour, 0, 0, true); BTree.getSizeMap(node)[i] += leaves ? 1 : 1 + BTree.size((Object[]) newNextNode[BTree.getChildEnd(newNextNode) - 1]); return newNextNode; }