private static BPTreeNode merge(BPTreeNode left, Record splitKey, BPTreeNode right) { // Merge blocks - does not adjust the parent. // Copy right to top of left. // Caller releases 'right' (needed for testing code). left.records.add(splitKey) ; // Copy over right to top of left. right.records.copyToTop(left.records) ; right.ptrs.copyToTop(left.ptrs) ; // Update count left.count = left.count + right.count + 1 ; left.internalCheckNode() ; right.records.clear() ; right.ptrs.clear() ; return left ; }
private static BPTreeNode merge(BPTreeNode left, Record splitKey, BPTreeNode right) { // Merge blocks - does not adjust the parent. // Copy right to top of left. // Caller releases 'right' (needed for testing code). left.records.add(splitKey) ; // Copy over right to top of left. right.records.copyToTop(left.records) ; right.ptrs.copyToTop(left.ptrs) ; // Update count left.count = left.count + right.count + 1 ; left.internalCheckNode() ; right.records.clear() ; right.ptrs.clear() ; return left ; }
@Override Record shiftLeft(BPTreePage other, Record splitKey) { BPTreeNode node = cast(other) ; if ( BPT.CheckingNode ) { if ( count == 0 ) BPT.error("Node is empty - can't shift a slot out") ; if ( isFull() ) BPT.error("Destination node is full") ; } Record r = node.records.getLow() ; // Records: promote moving element, replace with splitKey this.records.add(splitKey) ; node.records.shiftDown(0) ; // Pointers just shift this.ptrs.shiftLeft(node.ptrs) ; this.count++ ; node.count-- ; return r ; }
@Override Record shiftLeft(BPTreePage other, Record splitKey) { BPTreeNode node = cast(other) ; if ( BPT.CheckingNode ) { if ( count == 0 ) BPT.error("Node is empty - can't shift a slot out") ; if ( isFull() ) BPT.error("Destination node is full") ; } Record r = node.records.getLow() ; // Records: promote moving element, replace with splitKey this.records.add(splitKey) ; node.records.shiftDown(0) ; // Pointers just shift this.ptrs.shiftLeft(node.ptrs) ; this.count++ ; node.count-- ; return r ; }
@Override Record shiftRight(BPTreePage other, Record splitKey) { BPTreeNode node = cast(other) ; if ( BPT.CheckingNode ) { if ( count == 0 ) BPT.error("Node is empty - can't shift a slot out") ; if ( node.isFull() ) BPT.error("Destination node is full") ; } // Records: promote moving element, replace with splitKey Record r = this.records.getHigh() ; this.records.removeTop() ; node.records.add(0, splitKey) ; // Pointers just shift this.ptrs.shiftRight(node.ptrs) ; this.count-- ; node.count++ ; this.internalCheckNode() ; node.internalCheckNode() ; return r ; }
@Override Record shiftRight(BPTreePage other, Record splitKey) { BPTreeNode node = cast(other) ; if ( BPT.CheckingNode ) { if ( count == 0 ) BPT.error("Node is empty - can't shift a slot out") ; if ( node.isFull() ) BPT.error("Destination node is full") ; } // Records: promote moving element, replace with splitKey Record r = this.records.getHigh() ; this.records.removeTop() ; node.records.add(0, splitKey) ; // Pointers just shift this.ptrs.shiftRight(node.ptrs) ; this.count-- ; node.count++ ; this.internalCheckNode() ; node.internalCheckNode() ; return r ; }
BPTreeNode n = cast(sub) ;
BPTreeNode n = cast(sub) ;