boolean advanceLeafNode(boolean forwards) { return forwards ? ++position < getLeafKeyEnd(node) : --position >= 0; }
boolean advanceLeafNode(boolean forwards) { return forwards ? ++position < getLeafKeyEnd(node) : --position >= 0; }
boolean advanceLeafNode(boolean forwards) { return forwards ? ++position < getLeafKeyEnd(node) : --position >= 0; }
boolean advanceLeafNode(boolean forwards) { return forwards ? ++position < getLeafKeyEnd(node) : --position >= 0; }
public static int size(Object[] tree) { if (isLeaf(tree)) return getLeafKeyEnd(tree); int length = tree.length; // length - 1 == getChildEnd == getPositionOfSizeMap // (length / 2) - 1 == getChildCount - 1 == position of full tree size // hard code this, as will be used often; return ((int[]) tree[length - 1])[(length / 2) - 1]; }
public static int size(Object[] tree) { if (isLeaf(tree)) return getLeafKeyEnd(tree); int length = tree.length; // length - 1 == getChildEnd == getPositionOfSizeMap // (length / 2) - 1 == getChildCount - 1 == position of full tree size // hard code this, as will be used often; return ((int[]) tree[length - 1])[(length / 2) - 1]; }
public static int size(Object[] tree) { if (isLeaf(tree)) return getLeafKeyEnd(tree); int length = tree.length; // length - 1 == getChildEnd == getPositionOfSizeMap // (length / 2) - 1 == getChildCount - 1 == position of full tree size // hard code this, as will be used often; return ((int[]) tree[length - 1])[(length / 2) - 1]; }
public static int size(Object[] tree) { if (isLeaf(tree)) return getLeafKeyEnd(tree); int length = tree.length; // length - 1 == getChildEnd == getPositionOfSizeMap // (length / 2) - 1 == getChildCount - 1 == position of full tree size // hard code this, as will be used often; return ((int[]) tree[length - 1])[(length / 2) - 1]; }
static int getKeyEnd(Object[] node) { if (isLeaf(node)) return getLeafKeyEnd(node); else return getBranchKeyEnd(node); }
static int getKeyEnd(Object[] node) { if (isLeaf(node)) return getLeafKeyEnd(node); else return getBranchKeyEnd(node); }
static int getKeyEnd(Object[] node) { if (isLeaf(node)) return getLeafKeyEnd(node); else return getBranchKeyEnd(node); }
static int getKeyEnd(Object[] node) { if (isLeaf(node)) return getLeafKeyEnd(node); else return getBranchKeyEnd(node); }
static int getKeyEnd(Object[] node) { if (isLeaf(node)) return getLeafKeyEnd(node); else return getBranchKeyEnd(node); }
NodeCursor<K> descendToFirstChild(boolean forwards) { if (isLeaf()) { position = forwards ? 0 : getLeafKeyEnd(node) - 1; return null; } inChild = true; position = forwards ? 0 : getChildCount(node) - 1; return descend(); }
NodeCursor<K> descendToFirstChild(boolean forwards) { if (isLeaf()) { position = forwards ? 0 : getLeafKeyEnd(node) - 1; return null; } inChild = true; position = forwards ? 0 : getChildCount(node) - 1; return descend(); }
NodeCursor<K> descendToFirstChild(boolean forwards) { if (isLeaf()) { position = forwards ? 0 : getLeafKeyEnd(node) - 1; return null; } inChild = true; position = forwards ? 0 : getChildCount(node) - 1; return descend(); }
NodeCursor<K> descendToFirstChild(boolean forwards) { if (isLeaf()) { position = forwards ? 0 : getLeafKeyEnd(node) - 1; return null; } inChild = true; position = forwards ? 0 : getChildCount(node) - 1; return descend(); }
/** * ensures a leaf node we have seeked in, is not positioned outside of its bounds, * by moving us into its parents (if any); if it is the root, we're permitted to be out-of-bounds * as this indicates exhaustion */ private NodeCursor<K> ensureValidLocation(boolean forwards, NodeCursor<K> cur) { assert cur.isLeaf(); int position = cur.position; // if we're out of bounds of the leaf, move once in direction of travel if ((position < 0) | (position >= getLeafKeyEnd(cur.node))) cur = moveOutOfLeaf(forwards, cur, root()); return cur; }
/** * ensures a leaf node we have seeked in, is not positioned outside of its bounds, * by moving us into its parents (if any); if it is the root, we're permitted to be out-of-bounds * as this indicates exhaustion */ private NodeCursor<K> ensureValidLocation(boolean forwards, NodeCursor<K> cur) { assert cur.isLeaf(); int position = cur.position; // if we're out of bounds of the leaf, move once in direction of travel if ((position < 0) | (position >= getLeafKeyEnd(cur.node))) cur = moveOutOfLeaf(forwards, cur, root()); return cur; }
/** * ensures a leaf node we have seeked in, is not positioned outside of its bounds, * by moving us into its parents (if any); if it is the root, we're permitted to be out-of-bounds * as this indicates exhaustion */ private NodeCursor<K> ensureValidLocation(boolean forwards, NodeCursor<K> cur) { assert cur.isLeaf(); int position = cur.position; // if we're out of bounds of the leaf, move once in direction of travel if ((position < 0) | (position >= getLeafKeyEnd(cur.node))) cur = moveOutOfLeaf(forwards, cur, root()); return cur; }