|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimpledb.index.btree.BTreePage
public class BTreePage
B-tree directory and leaf pages have many commonalities: in particular, their records are stored in sorted order, and pages split when full. A BTreePage object contains this common functionality.
Constructor Summary | |
---|---|
BTreePage(Block currentblk,
TableInfo ti,
Transaction tx)
Opens a page for the specified B-tree block. |
Method Summary | |
---|---|
Block |
appendNew(int flag)
Appends a new block to the end of the specified B-tree file, having the specified flag value. |
void |
close()
Closes the page by unpinning its buffer. |
void |
delete(int slot)
Deletes the index record at the specified slot. |
int |
findSlotBefore(Constant searchkey)
Calculates the position where the first record having the specified search key should be, then returns the position before it. |
int |
getChildNum(int slot)
Returns the block number stored in the index record at the specified slot. |
RID |
getDataRid(int slot)
Returns the dataRID value stored in the specified leaf index record. |
Constant |
getDataVal(int slot)
Returns the dataval of the record at the specified slot. |
int |
getFlag()
Returns the value of the page's flag field |
int |
getNumRecs()
Returns the number of index records in this page. |
void |
insertDir(int slot,
Constant val,
int blknum)
Inserts a directory entry at the specified slot. |
void |
insertLeaf(int slot,
Constant val,
RID rid)
Inserts a leaf index record at the specified slot. |
boolean |
isFull()
Returns true if the block is full. |
void |
setFlag(int val)
Sets the page's flag field to the specified value |
Block |
split(int splitpos,
int flag)
Splits the page at the specified position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BTreePage(Block currentblk, TableInfo ti, Transaction tx)
currentblk
- a reference to the B-tree blockti
- the metadata for the particular B-tree filetx
- the calling transactionMethod Detail |
---|
public int findSlotBefore(Constant searchkey)
searchkey
- the search key
public void close()
public boolean isFull()
public Block split(int splitpos, int flag)
splitpos
- the split positionflag
- the initial value of the flag field
public Constant getDataVal(int slot)
slot
- the integer slot of an index record
public int getFlag()
public void setFlag(int val)
val
- the new value of the page flagpublic Block appendNew(int flag)
flag
- the initial value of the flag
public int getChildNum(int slot)
slot
- the slot of an index record
public void insertDir(int slot, Constant val, int blknum)
slot
- the slot of an index recordval
- the dataval to be storedblknum
- the block number to be storedpublic RID getDataRid(int slot)
slot
- the slot of the desired index record
public void insertLeaf(int slot, Constant val, RID rid)
slot
- the slot of the desired index recordval
- the new datavalrid
- the new dataRIDpublic void delete(int slot)
slot
- the slot of the deleted index recordpublic int getNumRecs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |