btree
Class BTLeafPage
java.lang.Object
diskmgr.Page
heap.HFPage
btree.BTSortedPage
btree.BTLeafPage
- All Implemented Interfaces:
- heap.ConstSlot, GlobalConst
- public class BTLeafPage
- extends BTSortedPage
A BTLeafPage is a leaf page on a B+ tree. It holds abstract
pairs; it doesn't know anything about the keys
(their lengths or their types), instead relying on the abstract
interface consisting of BT.java.
Fields inherited from class heap.HFPage |
CUR_PAGE, DPFIXED, EMPTY_SLOT, FREE_SPACE, INVALID_SLOT, NEXT_PAGE, PREV_PAGE, SIZE_OF_SLOT, SLOT_CNT, TYPE, USED_PTR |
Fields inherited from interface global.GlobalConst |
INVALID_PAGE, MAX_NAME, MAX_SPACE, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, MINIBASE_PAGESIZE, NUMBUF |
Constructor Summary |
BTLeafPage(int keyType)
new a page, associate the BTLeafPage instance with the Page instance,
also it sets the type to be NodeType.LEAF. |
BTLeafPage(PageId pageno,
int keyType)
pin the page with pageno, and get the corresponding BTLeafPage,
also it sets the type to be NodeType.LEAF. |
BTLeafPage(Page page,
int keyType)
associate the BTLeafPage instance with the Page instance,
also it sets the type to be NodeType.LEAF. |
Methods inherited from class heap.HFPage |
available_space, deleteRecord, dumpPage, empty, firstRecord, getCurPage, getHFpageArray, getNextPage, getPrevPage, getRecord, getSlotCnt, getSlotLength, getSlotOffset, getType, init, insertRecord, nextRecord, openHFpage, returnRecord, setCurPage, setNextPage, setPrevPage, setSlot, setType |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BTLeafPage
public BTLeafPage(PageId pageno,
int keyType)
throws java.io.IOException,
ConstructPageException
- pin the page with pageno, and get the corresponding BTLeafPage,
also it sets the type to be NodeType.LEAF.
- Parameters:
pageno
- Input parameter. To specify which page number the
BTLeafPage will correspond to.keyType
- either AttrType.attrInteger or AttrType.attrString.
Input parameter.
- Throws:
java.io.IOException
- error from the lower layer
ConstructPageException
- BTLeafPage constructor error
BTLeafPage
public BTLeafPage(Page page,
int keyType)
throws java.io.IOException,
ConstructPageException
- associate the BTLeafPage instance with the Page instance,
also it sets the type to be NodeType.LEAF.
- Parameters:
page
- input parameter. To specify which page the
BTLeafPage will correspond to.keyType
- either AttrType.attrInteger or AttrType.attrString.
Input parameter.
- Throws:
java.io.IOException
- error from the lower layer
ConstructPageException
- BTLeafPage constructor error
BTLeafPage
public BTLeafPage(int keyType)
throws java.io.IOException,
ConstructPageException
- new a page, associate the BTLeafPage instance with the Page instance,
also it sets the type to be NodeType.LEAF.
- Parameters:
keyType
- either AttrType.attrInteger or AttrType.attrString.
Input parameter.
- Throws:
java.io.IOException
- error from the lower layer
ConstructPageException
- BTLeafPage constructor error
insertRecord
public RID insertRecord(KeyClass key,
RID dataRid)
throws LeafInsertRecException
- insertRecord
READ THIS DESCRIPTION CAREFULLY. THERE ARE TWO RIDs
WHICH MEAN TWO DIFFERENT THINGS.
Inserts a key, rid value into the leaf node. This is
accomplished by a call to SortedPage::insertRecord()
Parameters:
- Parameters:
key
- - the key value of the data record. Input parameter.dataRid
- - the rid of the data record. This is
stored on the leaf page along with the
corresponding key value. Input parameter.
- Returns:
- - the rid of the inserted leaf record data entry,
i.e., the pair.
- Throws:
LeafInsertRecException
- error when insert
getFirst
public KeyDataEntry getFirst(RID rid)
throws IteratorException
- Iterators.
One of the two functions: getFirst and getNext
which provide an iterator interface to the records on a BTLeafPage.
- Parameters:
rid
- It will be modified and the first rid in the leaf page
will be passed out by itself. Input and Output parameter.
- Returns:
- return the first KeyDataEntry in the leaf page.
null if no more record
- Throws:
IteratorException
- iterator error
getNext
public KeyDataEntry getNext(RID rid)
throws IteratorException
- Iterators.
One of the two functions: getFirst and getNext which provide an
iterator interface to the records on a BTLeafPage.
- Parameters:
rid
- It will be modified and the next rid will be passed out
by itself. Input and Output parameter.
- Returns:
- return the next KeyDataEntry in the leaf page.
null if no more record.
- Throws:
IteratorException
- iterator error
getCurrent
public KeyDataEntry getCurrent(RID rid)
throws IteratorException
- getCurrent returns the current record in the iteration; it is like
getNext except it does not advance the iterator.
- Parameters:
rid
- the current rid. Input and Output parameter. But
Output=Input.
- Returns:
- return the current KeyDataEntry
- Throws:
IteratorException
- iterator error
delEntry
public boolean delEntry(KeyDataEntry dEntry)
throws LeafDeleteException
- delete a data entry in the leaf page.
- Parameters:
dEntry
- the entry will be deleted in the leaf page. Input parameter.
- Returns:
- true if deleted; false if no dEntry in the page
- Throws:
LeafDeleteException
- error when delete