|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglobal.Page
index.SortedPage
class SortedPage
A base class for index pages that automatically stores records in ascending order by key value. SortedPage supports variable-length records by using a slot directory, with the slots at the front and the records in the back, both growing and shrinking into and from the free space in the middle of the page.
Field Summary |
---|
Fields inherited from class global.Page |
---|
data |
Fields inherited from interface global.GlobalConst |
---|
EMPTY_SLOT, FIRST_PAGEID, INVALID_PAGEID, MAX_COLSIZE, MAX_TUPSIZE, NAME_MAXLEN, PAGE_SIZE, PIN_DISKIO, PIN_MEMCPY, UNPIN_CLEAN, UNPIN_DIRTY |
Constructor Summary | |
---|---|
SortedPage()
Default constructor; creates a sorted page with default values. |
|
SortedPage(Page page)
Constructor that wraps an existing sorted page. |
Method Summary | |
---|---|
boolean |
deleteEntry(DataEntry entry)
Deletes a record from the page, compacting the free space (including the slot directory). |
int |
findEntry(SearchKey key)
Searches for the first entry that matches the given search key. |
DataEntry |
getEntryAt(int slotno)
Gets the entry at the given slot number. |
short |
getEntryCount()
Gets the number of entries on the page. |
SearchKey |
getFirstKey()
Gets the key of the first entry on the page. |
short |
getFreeSpace()
Gets the amount of free space (in bytes). |
SearchKey |
getKeyAt(int slotno)
Gets the key at the given slot number. |
PageId |
getNextPage()
Gets the next page's id. |
boolean |
insertEntry(DataEntry entry)
Inserts a new record into the page in sorted order. |
int |
nextEntry(SearchKey key,
int slotno)
Searches for the next entry that matches the given search key, and stored after the given slot. |
void |
setNextPage(PageId pageno)
Sets the next page's id. |
Methods inherited from class global.Page |
---|
copyPage, getCharValue, getData, getFloatValue, getIntValue, getShortValue, getStringValue, setCharValue, setData, setFloatValue, setIntValue, setPage, setShortValue, setStringValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SortedPage()
public SortedPage(Page page)
Method Detail |
---|
public short getEntryCount()
public short getFreeSpace()
public PageId getNextPage()
public void setNextPage(PageId pageno)
public DataEntry getEntryAt(int slotno)
java.lang.IllegalArgumentException
- if the slot number is invalidpublic SearchKey getKeyAt(int slotno)
java.lang.IllegalArgumentException
- if the slot number is invalidpublic SearchKey getFirstKey()
java.lang.IllegalStateException
- if the page is emptypublic boolean insertEntry(DataEntry entry)
java.lang.IllegalStateException
- if insufficient spacepublic boolean deleteEntry(DataEntry entry)
java.lang.IllegalArgumentException
- if the entry doesn't existpublic int findEntry(SearchKey key)
public int nextEntry(SearchKey key, int slotno)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |