|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--br.usp.ime.jbase.HFPage
Auxiliary class with static methods that deal with heap file pages. Cannot be instantiated.
HFPage lay-out:
+---------------------------------------------+
start of page ---> | start of a record \ |
| ... | |
| start of a record | |
| ... | (n records) |
| ... | |
| start of a record | |
| ... / |
| start of free area |
| ... |
| slot dir area: recPos n-1 [2 bytes] |
| recLen n-1 [2 bytes] |
| ... |
| recPos 1 [2 bytes] |
| recLen 1 [2 bytes] |
| recPos 0 [2 bytes] |
| recLen 0 [2 bytes] |
| page id of this page [8 bytes] |
| page id of next page [8 bytes] |
| page id of previous page [8 bytes] |
| page type [2 bytes] |
| number of free bytes in this page [2 bytes] |
| pointer to start of free area [2 bytes] |
| number of slots (n in this case) [2 bytes] |
end of page -----> +---------------------------------------------+
| Field Summary | |
(package private) static long |
FAIL
|
| Method Summary | |
(package private) static int |
availableSpace(br.usp.ime.jbase.Page page)
Returns the available space (in bytes) on a page. |
(package private) static void |
compactSlotDir(Buffer b)
Compacts the slot directory, if possible. |
(package private) static boolean |
deleteRecord(Buffer b,
long recId)
Deletes a record from a page. |
(package private) static void |
dump(Buffer b)
Debugging method that prints out the fields of a page. |
(package private) static long |
firstRecord(Buffer b)
Starts an iteration over the records of a page. |
(package private) static long |
getNext(Buffer b)
Returns the page id stored in the "next" field of a page. |
(package private) static long |
getPrevious(Buffer b)
Returns the page id stored in the "previous" field of a page. |
(package private) static boolean |
getRecord(Buffer b,
long recId,
br.usp.ime.jbase.DBObject obj)
Gets a record from a page. |
(package private) static int |
getSlot(Buffer b,
long recId)
Gets the lenght and the position of a record within a page. |
(package private) static void |
init(br.usp.ime.jbase.Page page)
Initializes a database page as a heap file page. |
(package private) static long |
insertRecord(Buffer b,
br.usp.ime.jbase.DBObject obj)
Inserts a new record on a page. |
(package private) static boolean |
isEmpty(Buffer b)
Checks is a page is empty. |
(package private) static long |
nextRecord(Buffer b,
long curRecId)
Continues an iteration over the records of a page. |
(package private) static void |
setNext(Buffer b,
long aPageId)
Sets the "next" field of a page. |
(package private) static void |
setPrevious(Buffer b,
long aPageId)
Sets the "previous" field of a page. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final long FAIL
| Method Detail |
static void init(br.usp.ime.jbase.Page page)
page - the database page to be initialized.static void dump(Buffer b)
b - a Buffer with the page.static long getPrevious(Buffer b)
b - a Buffer with the page
static void setPrevious(Buffer b,
long aPageId)
b - a Buffer with the pageaPageId - the new value of the "previous" field.static long getNext(Buffer b)
b - a Buffer with the page
static void setNext(Buffer b,
long aPageId)
b - a Buffer with the pageaPageId - the new value of the "next" field.
static long insertRecord(Buffer b,
br.usp.ime.jbase.DBObject obj)
throws java.io.UTFDataFormatException
b - a Buffer with the pageobj - the object to be stored on the new recordFAIL if
there is not enough space for the new record on the page.
static boolean deleteRecord(Buffer b,
long recId)
deleteRecord leaves a hole in the slot directory entry
which pointed to the deleted record.b - a Buffer with the pagerecId - the record id of the record to be deletedrecId on the page.static long firstRecord(Buffer b)
b - a Buffer with the pageFAIL if there is no record in the page.
static long nextRecord(Buffer b,
long curRecId)
b - a Buffer with the pagecurRecId - the record id of the "current record"FAIL if there is no such record.
static boolean getRecord(Buffer b,
long recId,
br.usp.ime.jbase.DBObject obj)
throws java.io.UTFDataFormatException
b - a Buffer with the pagerecId - the record id of the recordobj - an object whose fields are to be read from the recordrecId on the page.
static int getSlot(Buffer b,
long recId)
b - a Buffer with the pagerecId - the record id of the recordFAIL if there is record with the given
recId on the page, otherwise returns an int made
up of two shorts joined together. The low order (least
significant) short is the record position within the page, the
high order (most significant) short is the record length.static int availableSpace(br.usp.ime.jbase.Page page)
b - a Buffer with the pagestatic boolean isEmpty(Buffer b)
b - a Buffer with the pagestatic void compactSlotDir(Buffer b)
b - a Buffer with the page
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||