public class TreeIndexHeader extends DefaultPageHeader
Modifier and Type | Field and Description |
---|---|
(package private) int |
dirCapacity
The capacity of a directory node (= 1 + maximum number of entries in a
directory node).
|
(package private) int |
dirMinimum
The minimum number of entries in a directory node.
|
private int |
emptyPagesSize
The number of bytes additionally needed for the listing of empty pages of
the headed page file.
|
private int |
largestPageID
The largest ID used so far
|
(package private) int |
leafCapacity
The capacity of a leaf node (= 1 + maximum number of entries in a leaf
node).
|
(package private) int |
leafMinimum
The minimum number of entries in a leaf node.
|
private static int |
SIZE
The size of this header in Bytes, which is 20 Bytes ( 4 Bytes for
dirCapacity , leafCapacity , dirMinimum ,
leafMinimum , and emptyPagesSize ). |
Constructor and Description |
---|
TreeIndexHeader()
Empty constructor for serialization.
|
TreeIndexHeader(int pageSize,
int dirCapacity,
int leafCapacity,
int dirMinimum,
int leafMinimum)
Creates a new header with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
getDirCapacity()
Returns the capacity of a directory node (= 1 + maximum number of entries
in a directory node).
|
int |
getDirMinimum()
Returns the minimum number of entries in a directory node.
|
int |
getEmptyPagesSize() |
int |
getLargestPageID() |
int |
getLeafCapacity()
Returns the capacity of a leaf node (= 1 + maximum number of entries in a
leaf node).
|
int |
getLeafMinimum()
Returns the minimum number of entries in a leaf node.
|
Stack<Integer> |
readEmptyPages(RandomAccessFile file)
Read the empty pages from the end of
file . |
void |
readHeader(RandomAccessFile file)
Initializes this header from the specified file.
|
void |
setEmptyPagesSize(int emptyPagesSize)
Set the size required by the listing of empty pages.
|
void |
setLargestPageID(int largestPageID) |
int |
size()
Returns
DefaultPageHeader.size()
plus the value of SIZE ). |
void |
writeEmptyPages(Stack<Integer> emptyPages,
RandomAccessFile file)
Write the indices of empty pages the the end of
file . |
void |
writeHeader(RandomAccessFile file)
Writes this header to the specified file.
|
asByteArray, getPageSize, getReservedPages, readHeader
private static int SIZE
dirCapacity
, leafCapacity
, dirMinimum
,
leafMinimum
, and emptyPagesSize
).int dirCapacity
int leafCapacity
int dirMinimum
int leafMinimum
private int emptyPagesSize
private int largestPageID
public TreeIndexHeader()
public TreeIndexHeader(int pageSize, int dirCapacity, int leafCapacity, int dirMinimum, int leafMinimum)
pageSize
- the size of a page in bytesdirCapacity
- the maximum number of entries in a directory nodeleafCapacity
- the maximum number of entries in a leaf nodedirMinimum
- the minimum number of entries in a directory nodeleafMinimum
- the minimum number of entries in a leaf nodepublic void readHeader(RandomAccessFile file) throws IOException
DefaultPageHeader#readHeader(file)
and reads the integer values of
dirCapacity
, leafCapacity
, dirMinimum
,
leafMinimum
and emptyPagesSize
from the file.readHeader
in interface PageHeader
readHeader
in class DefaultPageHeader
file
- the file to which this header belongsIOException
- if an I/O-error occurs during readingpublic void writeHeader(RandomAccessFile file) throws IOException
dirCapacity
, leafCapacity
, dirMinimum
,
leafMinimum
and emptyPagesSize
to the file.writeHeader
in interface PageHeader
writeHeader
in class DefaultPageHeader
file
- the file to which this header belongsIOException
- IOException if an I/O-error occurs during writingpublic int getDirCapacity()
public int getLeafCapacity()
public int getDirMinimum()
public int getLeafMinimum()
public int getEmptyPagesSize()
public void setEmptyPagesSize(int emptyPagesSize)
emptyPagesSize
- the number of bytes needed for this listing of empty
pagespublic int getLargestPageID()
public void setLargestPageID(int largestPageID)
public int size()
DefaultPageHeader.size()
plus the value of SIZE
). Note, this is only the base size and
probably not the overall size of this header, as there may be
empty pages to be maintained.size
in interface PageHeader
size
in class DefaultPageHeader
public void writeEmptyPages(Stack<Integer> emptyPages, RandomAccessFile file) throws IOException
file
. Calling
this method should be followed by a writeHeader(RandomAccessFile)
.emptyPages
- the stack of empty page ids which remain to be filledfile
- File to work withIOException
- thrown on IO errorspublic Stack<Integer> readEmptyPages(RandomAccessFile file) throws IOException, ClassNotFoundException
file
.file
- File to work withfile
IOException
- thrown on IO errorsClassNotFoundException
- if the stack of empty pages could not be
correctly read from fileCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.