All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class btree.BTIndexPage

java.lang.Object
   |
   +----diskmgr.Page
           |
           +----heap.HFPage
                   |
                   +----btree.BTSortedPage
                           |
                           +----btree.BTIndexPage

public class BTIndexPage
extends BTSortedPage
A BTIndexPage is an index page on a B+ tree. It holds abstract {key, PageId} pairs; it doesn't know anything about the keys (their lengths or their types), instead relying on the abstract interface in BT.java See those files for our {key,data} pairing interface and implementation.


Constructor Index

 o BTIndexPage(int)
 o BTIndexPage(Page, int)
associate the BTIndexPage instance with the Page instance, also it sets the type of node to be NodeType.INDEX.
 o BTIndexPage(PageId, int)
pin the page with pageno, and get the corresponding BTIndexPage, also it sets the type of node to be NodeType.INDEX.

Method Index

 o getFirst(RID)
Iterators.
 o getLeftLink()
Left Link You will recall that the index pages have a left-most pointer that is followed whenever the search key value is less than the least key value in the index node.
 o getNext(RID)
Iterators.
 o getPageNoByKey(KeyClass)
 o insertKey(KeyClass, PageId)
It inserts a value into the index page,
 o setLeftLink(PageId)
You will recall that the index pages have a left-most pointer that is followed whenever the search key value is less than the least key value in the index node.

Constructors

 o BTIndexPage
 public BTIndexPage(PageId pageno,
                    int keyType)
pin the page with pageno, and get the corresponding BTIndexPage, also it sets the type of node to be NodeType.INDEX.

Parameters:
pageno - Input parameter. To specify which page number the BTIndexPage will correspond to.
keyType - either AttrType.attrInteger or AttrType.attrString. Input parameter.
 o BTIndexPage
 public BTIndexPage(Page page,
                    int keyType)
associate the BTIndexPage instance with the Page instance, also it sets the type of node to be NodeType.INDEX.

Parameters:
page - input parameter. To specify which page the BTIndexPage will correspond to.
keyType - either AttrType.attrInteger or AttrType.attrString. Input parameter.
 o BTIndexPage
 public BTIndexPage(int keyType)

Methods

 o insertKey
 public RID insertKey(KeyClass key,
                      PageId pageNo)
It inserts a value into the index page,

Parameters:
key - the key value in . Input parameter.
pageNo - the pageNo in . Input parameter.
Returns:
It returns the rid where the record is inserted; null if no space left.
 o getPageNoByKey
 public PageId getPageNoByKey(KeyClass key)
 o getFirst
 public KeyDataEntry getFirst(RID rid)
Iterators. One of the two functions: getFirst and getNext which provide an iterator interface to the records on a BTIndexPage.

Parameters:
rid - It will be modified and the first rid in the index page will be passed out by itself. Input and Output parameter.
Returns:
return the first KeyDataEntry in the index page. null if NO MORE RECORD
 o getNext
 public KeyDataEntry getNext(RID rid)
Iterators. One of the two functions: getFirst and getNext which provide an iterator interface to the records on a BTIndexPage.

Parameters:
rid - It will be modified and next rid will be passed out by itself. Input and Output parameter.
Returns:
return the next KeyDataEntry in the index page. null if no more record
 o getLeftLink
 public PageId getLeftLink()
Left Link You will recall that the index pages have a left-most pointer that is followed whenever the search key value is less than the least key value in the index node. The previous page pointer is used to implement the left link.

Returns:
It returns the left most link.
 o setLeftLink
 public void setLeftLink(PageId left)
You will recall that the index pages have a left-most pointer that is followed whenever the search key value is less than the least key value in the index node. The previous page pointer is used to implement the left link. The function sets the left link.

Parameters:
left - the PageId of the left link you wish to set. Input parameter.

All Packages  Class Hierarchy  This Package  Previous  Next  Index