new public int Get(object obj) #endif { StorageImpl db = (StorageImpl)Storage; if (root == 0) { throw new StorageError(StorageError.ErrorCode.KEY_NOT_FOUND); } #if USE_GENERICS return(BitIndexPage.find(db, root, db.GetOid(obj), height)); #else return(BitIndexPage.find(db, root, db.GetOid(obj), height)); #endif }
public bool Remove(object obj) #endif { StorageImpl db = (StorageImpl)Storage; if (db == null) { throw new StorageError(StorageError.ErrorCode.DELETED_OBJECT); } if (root == 0) { return(false); } BtreeResult result = BitIndexPage.remove(db, root, db.GetOid(obj), height); if (result == BtreeResult.NotFound) { return(false); } nElems -= 1; if (result == BtreeResult.Underflow) { Page pg = db.getPage(root); if (BitIndexPage.getnItems(pg) == 0) { int newRoot = 0; if (height != 1) { newRoot = BitIndexPage.getItem(pg, BitIndexPage.maxItems - 1); } db.freePage(root); root = newRoot; height -= 1; } db.pool.unfix(pg); } updateCounter += 1; Modify(); return(true); }