Page

A page. Format:
  • 0-3: parent page id (0 for root)
  • 4-4: page type
  • page-type specific data


Methods
static void add(int[] array, int from, int to, int x)
Add a value to a subset of the array.
static void add(int[] array, int from, int to, int x)
Add a value to a subset of the array.
Parameters:
array - the array
from - the index of the first element (including)
to - the index of the last element (excluding)
x - the value to add
static T[] insert(T[] old, int oldSize, int pos, T x)
Insert a value in an array.
static T[] insert(T[] old, int oldSize, int pos, T x)
Insert a value in an array. A new array is created if required.
Parameters:
old - the old array
oldSize - the old size
pos - the position
x - the value to insert
Returns:
the (new) array
static long[] insert(long[] old, int oldSize, int pos, long x)
Insert a value in an array.
static long[] insert(long[] old, int oldSize, int pos, long x)
Insert a value in an array. A new array is created if required.
Parameters:
old - the old array
oldSize - the old size
pos - the position
x - the value to insert
Returns:
the (new) array
static int[] insert(int[] old, int oldSize, int pos, int x)
Insert a value in an array.
static int[] insert(int[] old, int oldSize, int pos, int x)
Insert a value in an array. A new array is created if required.
Parameters:
old - the old array
oldSize - the old size
pos - the position
x - the value to insert
Returns:
the (new) array
static T[] remove(T[] old, int oldSize, int pos)
Delete a value in an array.
static T[] remove(T[] old, int oldSize, int pos)
Delete a value in an array. A new array is created if required.
Parameters:
old - the old array
oldSize - the old size
pos - the position
Returns:
the (new) array
static long[] remove(long[] old, int oldSize, int pos)
Delete a value in an array.
static long[] remove(long[] old, int oldSize, int pos)
Delete a value in an array. A new array is created if required.
Parameters:
old - the old array
oldSize - the old size
pos - the position
Returns:
the (new) array
static int[] remove(int[] old, int oldSize, int pos)
Delete a value in an array.
static int[] remove(int[] old, int oldSize, int pos)
Delete a value in an array. A new array is created if required.
Parameters:
old - the old array
oldSize - the old size
pos - the position
Returns:
the (new) array
boolean canMove()
If this page can be moved.
boolean canMove()
If this page can be moved. Transaction log and free-list pages can not.
Returns:
true if moving is allowed
void moveTo(Session session, int newPos)
Copy the data to a new location, change the parent to point to the new location, and free up the current page.
void moveTo(Session session, int newPos)
Copy the data to a new location, change the parent to point to the new location, and free up the current page.
Parameters:
session - the session
newPos - the new position
void write()
Write the page.
void write()
Write the page.

Fields
static int FLAG_LAST = 16
static int TYPE_BTREE_LEAF = 4
static int TYPE_BTREE_NODE = 5
static int TYPE_DATA_LEAF = 1
static int TYPE_DATA_NODE = 2
static int TYPE_DATA_OVERFLOW = 3
static int TYPE_EMPTY = 0
static int TYPE_FREE_LIST = 6
static int TYPE_STREAM_DATA = 8
static int TYPE_STREAM_TRUNK = 7
static long changeCount

TYPE_EMPTY = 0

An empty page.

TYPE_DATA_LEAF = 1

A data leaf page (without overflow: + FLAG_LAST).

FLAG_LAST = 16

This is the last page of a chain.

TYPE_DATA_NODE = 2

A data node page (never has overflow pages).

TYPE_DATA_OVERFLOW = 3

A data overflow page (the last page: + FLAG_LAST).

TYPE_BTREE_LEAF = 4

A b-tree leaf page (without overflow: + FLAG_LAST).

TYPE_BTREE_NODE = 5

A b-tree node page (never has overflow pages).

TYPE_FREE_LIST = 6

A page containing a list of free pages (the last page: + FLAG_LAST).

TYPE_STREAM_TRUNK = 7

A stream trunk page.

TYPE_STREAM_DATA = 8

A stream data page.

changeCount

When this page was changed the last time.