PageBtree

A page that contains index data.

Methods
int addRowTry(SearchRow row)
Add a row if possible.
int addRowTry(SearchRow row)
Add a row if possible. If it is possible this method returns -1, otherwise the split point. It is always possible to add one row.
Parameters:
row - the row to add
Returns:
the split point of this page, or -1 if no split is required
boolean canRemove()
boolean canRemove()
int find(SearchRow compare, boolean bigger, boolean add, boolean compareKeys)
Find an entry.
int find(SearchRow compare, boolean bigger, boolean add, boolean compareKeys)
Find an entry.
Parameters:
compare - the row
bigger - if looking for a larger row
add - if the row should be added (check for duplicate keys)
compareKeys - compare the row keys as well
Returns:
the index of the found row
void find(PageBtreeCursor cursor, SearchRow first, boolean bigger)
Find the first row.
void find(PageBtreeCursor cursor, SearchRow first, boolean bigger)
Find the first row.
Parameters:
cursor - the cursor
first - the row to find
bigger - if the row should be bigger
void freeRecursive()
Free this page and all child pages.
void freeRecursive()
Free this page and all child pages.
PageBtreeLeaf getFirstLeaf()
Get the first child leaf page of a page.
PageBtreeLeaf getFirstLeaf()
Get the first child leaf page of a page.
Returns:
the page
PageBtreeLeaf getLastLeaf()
Get the first child leaf page of a page.
PageBtreeLeaf getLastLeaf()
Get the first child leaf page of a page.
Returns:
the page
int getMemory()
Get the estimated memory size.
int getMemory()
Get the estimated memory size.
Returns:
number of double words (4 bytes)
SearchRow getRow(int at)
Get the row at this position.
SearchRow getRow(int at)
Get the row at this position.
Parameters:
at - the index
Returns:
the row
int getRowCount()
Get the real row count.
int getRowCount()
Get the real row count. If required, this will read all child pages.
Returns:
the row count
void last(PageBtreeCursor cursor)
Find the last row.
void last(PageBtreeCursor cursor)
Find the last row.
Parameters:
cursor - the cursor
void memoryChange()
The memory usage of this page was changed.
void memoryChange()
The memory usage of this page was changed. Propagate the change if needed.
void readAllRows()
Ensure all rows are read in memory.
void readAllRows()
Ensure all rows are read in memory.
void remapChildren()
Update the parent id of all children.
void remapChildren()
Update the parent id of all children.
SearchRow remove(SearchRow row)
Remove a row.
SearchRow remove(SearchRow row)
Remove a row.
Parameters:
row - the row to remove
Returns:
null if the last row didn't change, the deleted row if the page is now empty, otherwise the new last row of this page
void setPageId(int id)
Change the page id.
void setPageId(int id)
Change the page id.
Parameters:
id - the new page id
void setParentPageId(int id)
Change the parent page id.
void setParentPageId(int id)
Change the parent page id.
Parameters:
id - the new parent page id
void setRowCountStored(int rowCount)
Set the stored row count.
void setRowCountStored(int rowCount)
Set the stored row count. This will write the page.
Parameters:
rowCount - the stored row count
PageBtree split(int splitPoint)
Split the index page at the given point.
PageBtree split(int splitPoint)
Split the index page at the given point.
Parameters:
splitPoint - the index where to split
Returns:
the new page that contains about half the entries

Fields
static int ROOT = 0
static int UNKNOWN_ROWCOUNT = -1
static Data data
static int entryCount
static PageBtreeIndex index
static int[] offsets
static boolean onlyPosition
static int parentPageId
static SearchRow[] rows
static int start
static boolean written

UNKNOWN_ROWCOUNT = -1

Indicator that the row count is not known.

ROOT = 0

This is a root page.

data

The data page.

entryCount

The number of entries.

index

The index.

offsets

The row offsets.

onlyPosition

If only the position of the row is stored in the page

parentPageId

The page number of the parent.

rows

The index data

start

The start of the data area.

written

Whether the data page is up-to-date.