|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.dev.store.btree.Page
public class Page
A page (a node or a leaf).
For b-tree nodes, the key at a given index is larger than the largest key of the child at the same index.
File format: page length (including length): int check value: short map id: varInt number of keys: varInt type: byte (0: leaf, 1: node; +2: compressed) compressed: bytes saved (varInt) keys leaf: values (one for each key) node: children (1 more than keys)
| Method Summary | |
|---|---|
int |
binarySearch(java.lang.Object key)
Search the key in this page using a binary search. |
Page |
copyOnWrite(long writeVersion)
Create a copy of this page, if the write version is higher than the current version. |
static Page |
create(MVMap<?,?> map,
long version,
int keyCount,
java.lang.Object[] keys,
java.lang.Object[] values,
long[] children,
Page[] childrenPages,
long[] counts,
long totalCount,
int sharedFlags)
Create a new page. |
static Page |
createEmpty(MVMap<?,?> map,
long version)
Create a new, empty page. |
Page |
getChildPage(int index)
Get the child page at the given index. |
java.lang.Object |
getKey(int index)
Get the key at the given index. |
int |
getKeyCount()
Get the number of keys in this page. |
long |
getPos()
Get the position of the page |
long |
getTotalCount()
Get the total number of key-value pairs, including child pages. |
java.lang.Object |
getValue(int index)
Get the value at the given index. |
void |
insertLeaf(int index,
java.lang.Object key,
java.lang.Object value)
Insert a key-value pair into this leaf. |
void |
insertNode(int index,
java.lang.Object key,
Page childPage)
Insert a child into this node. |
boolean |
isLeaf()
Check whether this is a leaf page. |
void |
remove(int index)
Remove the key and value (or child) at the given index. |
void |
setChild(int index,
Page c)
Replace the child page. |
void |
setKey(int index,
java.lang.Object key)
Replace the key. |
java.lang.Object |
setValue(int index,
java.lang.Object value)
Replace the value. |
Page |
split(int at)
Split the page. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static Page createEmpty(MVMap<?,?> map,
long version)
map - the mapversion - the version
public static Page create(MVMap<?,?> map,
long version,
int keyCount,
java.lang.Object[] keys,
java.lang.Object[] values,
long[] children,
Page[] childrenPages,
long[] counts,
long totalCount,
int sharedFlags)
map - the mapversion - the versionkeyCount - the number of keyskeys - the keysvalues - the valueschildren - the childrenchildrenPages - the children pagescounts - the children countstotalCount - the total number of keyssharedFlags - which arrays are shared
public java.lang.Object getKey(int index)
index - the index
public Page getChildPage(int index)
index - the index
public java.lang.Object getValue(int index)
index - the index
public int getKeyCount()
public boolean isLeaf()
public long getPos()
public java.lang.String toString()
toString in class java.lang.Objectpublic Page copyOnWrite(long writeVersion)
writeVersion - the write version
public int binarySearch(java.lang.Object key)
key - the key
public Page split(int at)
at - the split index
public long getTotalCount()
public void setChild(int index,
Page c)
index - the indexc - the new child page
public void setKey(int index,
java.lang.Object key)
index - the indexkey - the new key
public java.lang.Object setValue(int index,
java.lang.Object value)
index - the indexvalue - the new value
public void insertLeaf(int index,
java.lang.Object key,
java.lang.Object value)
index - the indexkey - the keyvalue - the value
public void insertNode(int index,
java.lang.Object key,
Page childPage)
index - the indexkey - the keychildPage - the child pagepublic void remove(int index)
index - the index
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||