|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.persistent.DefaultPageHeader de.lmu.ifi.dbs.elki.index.tree.TreeIndexHeader
public class TreeIndexHeader
Encapsulates the header information of a tree-like index structure. This information is needed for persistent storage.
Field Summary | |
---|---|
(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 Summary | |
---|---|
TreeIndexHeader()
Empty constructor for serialization. |
|
TreeIndexHeader(int pageSize,
int dirCapacity,
int leafCapacity,
int dirMinimum,
int leafMinimum)
Creates a new header with the specified parameters. |
Method Summary | |
---|---|
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. |
Methods inherited from class de.lmu.ifi.dbs.elki.persistent.DefaultPageHeader |
---|
asByteArray, getPageSize, getReservedPages, readHeader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static int SIZE
dirCapacity
, leafCapacity
, dirMinimum
,
leafMinimum
, and emptyPagesSize
).
int dirCapacity
int leafCapacity
int dirMinimum
int leafMinimum
private int emptyPagesSize
private int largestPageID
Constructor Detail |
---|
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 nodeMethod Detail |
---|
public 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 belongs
IOException
- 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 belongs
IOException
- 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 with
IOException
- thrown on IO errorspublic Stack<Integer> readEmptyPages(RandomAccessFile file) throws IOException, ClassNotFoundException
file
.
file
- File to work with
file
IOException
- thrown on IO errors
ClassNotFoundException
- if the stack of empty pages could not be
correctly read from file
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |