@Override public Block toBlock(BPTreeRecords t) { return recordBufferConverter.toBlock(t.getRecordBufferPage()) ; }
@Override public Block toBlock(BPTreeRecords t) { return recordBufferConverter.toBlock(t.getRecordBufferPage()) ; }
private BPTreeRecords create(int linkId) { BPTreeRecords newPage = bprRecordsMgr.create() ; newPage.getRecordBufferPage().setLink(linkId) ; return newPage ; }
private BPTreeRecords create(int linkId) { BPTreeRecords newPage = bprRecordsMgr.create() ; newPage.getRecordBufferPage().setLink(linkId) ; return newPage ; }
/** * Split: place old high half in 'other'. Return the new (upper) * BPTreeRecords(BPTreePage). * Split is the high end of the low page. */ @Override public BPTreePage split() { BPTreeRecords other = insertNewPage() ; int splitIdx = rBuff.size() / 2 - 1 ; Record r = rBuff.get(splitIdx) ; // Only need key for checking later. int moveLen = rBuff.size() - (splitIdx + 1) ; // Number to move. // Copy high end to new. rBuff.copy(splitIdx + 1, other.getRecordBufferPage().getRecordBuffer(), 0, moveLen) ; rBuff.clear(splitIdx + 1, moveLen) ; rBuff.setSize(splitIdx + 1) ; if ( CheckingNode ) { if ( !Record.keyEQ(r, maxRecord()) ) { System.err.println(rBuff) ; System.err.println(other.rBuff) ; error("BPTreeRecords.split: Not returning expected record") ; } } return other ; }
/** * Split: place old high half in 'other'. Return the new (upper) * BPTreeRecords(BPTreePage). * Split is the high end of the low page. */ @Override public BPTreePage split() { BPTreeRecords other = insertNewPage() ; int splitIdx = rBuff.size() / 2 - 1 ; Record r = rBuff.get(splitIdx) ; // Only need key for checking later. int moveLen = rBuff.size() - (splitIdx + 1) ; // Number to move. // Copy high end to new. rBuff.copy(splitIdx + 1, other.getRecordBufferPage().getRecordBuffer(), 0, moveLen) ; rBuff.clear(splitIdx + 1, moveLen) ; rBuff.setSize(splitIdx + 1) ; if ( CheckingNode ) { if ( !Record.keyEQ(r, maxRecord()) ) { System.err.println(rBuff) ; System.err.println(other.rBuff) ; error("BPTreeRecords.split: Not returning expected record") ; } } return other ; }