private BPTreeNode create(int parent, boolean isLeaf) { return create(bpTree, parent, isLeaf) ; }
private BPTreeNode create(int parent, boolean isLeaf) { return create(bpTree, parent, isLeaf) ; }
/** Split this block - return the split record (key only needed) */ @Override final BPTreePage split() { // Median record : will go in parent. int ix = params.SplitIndex ; // New block. BPTreeNode z = create(this.parent, isLeaf) ; // Leave the low end untouched and copy, and clear the high end. // z becomes the new upper node, not the lower node. // 'this' is the lower block. int maxRec = maxRecords() ; // Copy from top of y into z. records.copy(ix + 1, z.records, 0, maxRec - (ix + 1)) ; records.clear(ix, maxRec - ix) ; // Clear copied and median slot records.setSize(ix) ; // Reset size ptrs.copy(ix + 1, z.ptrs, 0, params.MaxPtr - (ix + 1)) ; ptrs.clear(ix + 1, params.MaxPtr - (ix + 1)) ; ptrs.setSize(ix + 1) ; // Set sizes of subnodes setCount(ix) ; // Median is ix internalCheckNode() ; // y finished z.isLeaf = isLeaf ; z.setCount(maxRec - (ix + 1)) ; // Number copied into z // Caller puts the blocks in split(int, BTreePage) z.internalCheckNode() ; return z ; }
/** Split this block - return the split record (key only needed) */ @Override final BPTreePage split() { // Median record : will go in parent. int ix = params.SplitIndex ; // New block. BPTreeNode z = create(this.parent, isLeaf) ; // Leave the low end untouched and copy, and clear the high end. // z becomes the new upper node, not the lower node. // 'this' is the lower block. int maxRec = maxRecords() ; // Copy from top of y into z. records.copy(ix + 1, z.records, 0, maxRec - (ix + 1)) ; records.clear(ix, maxRec - ix) ; // Clear copied and median slot records.setSize(ix) ; // Reset size ptrs.copy(ix + 1, z.ptrs, 0, params.MaxPtr - (ix + 1)) ; ptrs.clear(ix + 1, params.MaxPtr - (ix + 1)) ; ptrs.setSize(ix + 1) ; // Set sizes of subnodes setCount(ix) ; // Median is ix internalCheckNode() ; // y finished z.isLeaf = isLeaf ; z.setCount(maxRec - (ix + 1)) ; // Number copied into z // Caller puts the blocks in split(int, BTreePage) z.internalCheckNode() ; return z ; }