Class BranchRow
- java.lang.Object
-
- org.apache.derby.impl.store.access.btree.BranchRow
-
public class BranchRow extends java.lang.Object
Implements row which is stored in the branch pages of a btree. A non-suffix compressed branch row contains all of the columns of the leaf rows of a btree and contains an additional field at the end. The extra field of a branch row in a branch page at level N, is the child page field pointing the page at level N-1 which has keys which follow or equal the branch row entry. There are 3 ways to use this class to produce a branch row: createEmptyTemplate() creates a empty row template createBranchRowFromOldBranchRow() creates a new row with reference to an old branch row. createBranchRowFromOldLeafRow() creates a new row with reference to an old leaf row.
-
-
Field Summary
Fields Modifier and Type Field Description private DataValueDescriptor[]
branchrow
The array of object to be used as the row.static long
DUMMY_PAGE_NUMBER
-
Constructor Summary
Constructors Modifier Constructor Description private
BranchRow()
Constuctor for creating an "empty" BranchRow template, suitable for reading in a branchRow from disk.private
BranchRow(Transaction rawtran, BTree btree)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BranchRow
createBranchRowFromOldBranchRow(long childpageno)
Create a new branch row, given a old branch row and a new child page.static BranchRow
createBranchRowFromOldLeafRow(DataValueDescriptor[] leafrow, long childpageno)
Create a new branch row, given a old leaf row and a new child page.static BranchRow
createEmptyTemplate(Transaction rawtran, BTree btree)
Create an empty branch row template suitable for reading branch rows in from disk.private SQLLongint
getChildPage()
Accessor for the child page field of the branch row.protected DataValueDescriptor[]
getRow()
Return the branch row.protected void
setPageNumber(long page_number)
Set the page number field of the branch row to a new value.java.lang.String
toString()
-
-
-
Field Detail
-
DUMMY_PAGE_NUMBER
public static final long DUMMY_PAGE_NUMBER
- See Also:
- Constant Field Values
-
branchrow
private DataValueDescriptor[] branchrow
The array of object to be used as the row.
-
-
Constructor Detail
-
BranchRow
private BranchRow()
Constuctor for creating an "empty" BranchRow template, suitable for reading in a branchRow from disk.
-
BranchRow
private BranchRow(Transaction rawtran, BTree btree) throws StandardException
- Throws:
StandardException
-
-
Method Detail
-
getChildPage
private SQLLongint getChildPage()
Accessor for the child page field of the branch row.- Returns:
- The child page object.
-
createEmptyTemplate
public static BranchRow createEmptyTemplate(Transaction rawtran, BTree btree) throws StandardException
Create an empty branch row template suitable for reading branch rows in from disk. This routine will create newly allocated "empty" objects for every column in the template row.- Throws:
StandardException
- Standard exception policy.
-
createBranchRowFromOldBranchRow
public BranchRow createBranchRowFromOldBranchRow(long childpageno)
Create a new branch row, given a old branch row and a new child page. Used by BranchControlRow to manufacture new branch rows when splitting or growing the tree. There is no way to "copy" values of a template row, so this class just stores a reference to each of the columns of the Indexable row passed in. This is ok as all usages of this class when instantiated this way, have an old branch row from which they are creating a new branch row with the same key values, and a different child page number. WARNING - this branch row is only valid while the old branch row is valid, as it contains references to the columns of the old branch row. So use of the row should only provide read-only access to the objects of the old branch row which are referenced.
-
createBranchRowFromOldLeafRow
public static BranchRow createBranchRowFromOldLeafRow(DataValueDescriptor[] leafrow, long childpageno)
Create a new branch row, given a old leaf row and a new child page. Used by LeafControlRow to manufacture new branch rows when splitting or growing the tree. There is no way to "copy" values of a template row, so this class just stores a referece to the Indexable row passed in. This is ok as all usages of this class when instantiated this way, have an old leaf row from which they are creating a new branch row with the same key values, and a different child page number. WARNING - this branch row is only valid while the old leaf row is valid, as it contains references to the columns of the old leaf row. So use of the row should only provide read-only access to the objects of the old leaf row which are referenced.
-
getRow
protected DataValueDescriptor[] getRow()
Return the branch row.Return the DataValueDescriptor array that represents the branch row, for use in raw store calls to fetch, insert, and update.
- Returns:
- The branch row object array.
-
setPageNumber
protected void setPageNumber(long page_number)
Set the page number field of the branch row to a new value.- Parameters:
page_number
- the new page number.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-