public class BPage<K,V> extends Object implements Serializer
The page contains a number of key-value pairs. Keys are ordered to allow dichotomic search.
If the page is a leaf page, the keys and values are user-defined and represent entries inserted by the user.
If the page is non-leaf, each key represents the greatest key in the underlying BPages and the values are recids pointing to the children BPages. The only exception is the rightmost BPage, which is considered to have an "infinite" key value, meaning that any insert will be to the left of this pseudo-key
Modifier and Type | Field and Description |
---|---|
protected long[] |
children
Children pages (recids) associated with keys.
|
protected int |
first
Index of first used item at the page
|
protected boolean |
isLeaf
Flag indicating if this is a leaf BPage.
|
protected K[] |
keys
Keys of children nodes
|
protected long |
next
Next leaf BPage (only if this BPage is a leaf)
|
protected long |
previous
Previous leaf BPage (only if this BPage is a leaf)
|
protected long |
recordId
This BPage's record ID in the PageManager.
|
protected V[] |
values
Values associated with keys.
|
Constructor and Description |
---|
BPage()
No-argument constructor used by serialization.
|
Modifier and Type | Method and Description |
---|---|
BPage<K,V> |
deserialize(byte[] serialized)
Deserialize the content of an object from a byte array.
|
long |
getRecordId() |
byte[] |
serialize(Object obj)
Serialize the content of an object into a byte array.
|
void |
setRecordId(long recordId)
Set the recordId
|
String |
toString() |
protected transient long recordId
protected boolean isLeaf
protected K[] keys
protected V[] values
protected long[] children
protected int first
protected long previous
protected long next
public long getRecordId()
public void setRecordId(long recordId)
recordId
- The recordIdpublic BPage<K,V> deserialize(byte[] serialized) throws IOException
deserialize
in interface Serializer
serialized
- Byte array representation of the objectIOException
public byte[] serialize(Object obj) throws IOException
serialize
in interface Serializer
obj
- Object to serializeIOException
Copyright © 2018. All rights reserved.