|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectHFPage
public class HFPage
Heap file page. This is a wrapper around a traditional Page that adds the appropriate struture to it.
| Nested Class Summary | |
|---|---|
static class |
HFPage.BadPageIdException
|
static class |
HFPage.BadSlotIdException
|
static class |
HFPage.PageFullException
|
| Field Summary | |
|---|---|
static int |
INVALID_PAGE
Value to use for an invalid page id. |
| Constructor Summary | |
|---|---|
HFPage(Page page)
Creates a heap file page object by wrapping around a page object already provided. |
|
| Method Summary | |
|---|---|
boolean |
deleteRecord(RID rid)
Deletes the record with the given RID from the page, compacting the hole created. |
void |
dumpPage()
Dumps out to the screen the id for this page, as well as the ids for the next and previous pages. |
boolean |
empty()
Whether or not the page is empty. |
RID |
firstRecord()
Returns RID of first record on page. |
int |
getAvailableSpace()
Determines how much space is actually available on the page, which depends on whether or not a new slot in the slot array is needed. |
int |
getNextPageId()
Gets the next page id. |
int |
getPageId()
Gets the page id. |
int |
getPrevPageId()
Gets the previous page id. |
byte[] |
getRecord(RID rid)
Returns the record associated with an RID. |
void |
init()
Initializes values on the heap file page as necessary. |
RID |
insertRecord(byte[] record)
Inserts a new record onto the page. |
RID |
nextRecord(RID curRid)
Returns RID of next record on the page, where "next on the page" means "next in the slot array." Remember that some slots may be empty, so you should skip over these. |
void |
setNextPageId(int pageId)
Sets the next page id. |
void |
setPageId(int pageId)
Sets the page id. |
void |
setPrevPageId(int pageId)
Sets the previous page id. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int INVALID_PAGE
| Constructor Detail |
|---|
public HFPage(Page page)
page - the page to be wrapped.| Method Detail |
|---|
public void init()
public void setPageId(int pageId)
pageId - the new page id.public int getPageId()
public void setNextPageId(int pageId)
pageId - the next page id.public int getNextPageId()
public void setPrevPageId(int pageId)
pageId - the previous page id.public int getPrevPageId()
public int getAvailableSpace()
public void dumpPage()
public RID insertRecord(byte[] record)
record - the record to be inserted. A copy of the data is
placed on the page.
HFPage.PageFullException - if there is not enough room for the
record on the page.public boolean deleteRecord(RID rid)
rid - the RID to be deleted.
public RID firstRecord()
public RID nextRecord(RID curRid)
curRid - an RID
HFPage.BadPageIdException - if the page id within curRid is
invalid
HFPage.BadSlotIdException - if the slot id within curRid is invalidpublic byte[] getRecord(RID rid)
rid - the rid of interest
HFPage.BadPageIdException - if the page id within curRid is
invalid
HFPage.BadSlotIdException - if the slot id within curRid is invalidpublic boolean empty()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||