private DirEntry insertEntry(DirEntry e) { int newslot = 1 + contents.findSlotBefore(e.dataVal()); contents.insertDir(newslot, e.dataVal(), e.blockNumber()); if (!contents.isFull()) return null; // else page is full, so split it int level = contents.getFlag(); int splitpos = contents.getNumRecs() / 2; Constant splitval = contents.getDataVal(splitpos); Block newblk = contents.split(splitpos, level); return new DirEntry(splitval, newblk.number()); }
private Block findChildBlock(Constant searchkey) { int slot = contents.findSlotBefore(searchkey); if (contents.getDataVal(slot + 1).equals(searchkey)) slot++; int blknum = contents.getChildNum(slot); return new Block(filename, blknum); }