public class TreeKeyIndex extends Object implements Activatable
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
private boolean |
active |
private SwordBookMetaData |
bmd |
private File |
datFile |
private RandomAccessFile |
datRaf |
private static String |
EXTENSION_DATA |
private static String |
EXTENSION_INDEX |
private File |
idxFile |
private RandomAccessFile |
idxRaf |
private static org.slf4j.Logger |
log
The log stream
|
| Constructor and Description |
|---|
TreeKeyIndex(SwordBookMetaData sbmd)
Simple ctor
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate(Lock lock)
Called to indicate that the Book should initialize itself, and consume
whatever system resources it needs to be able to respond to other
queries.
|
protected void |
checkActive()
Helper method so we can quickly activate ourselves on access
|
void |
deactivate(Lock lock)
Called to indicate that the Book should release whatever system resources
it can to make way for other uses.
|
private String |
getExpandedDataPath() |
TreeNode |
getFirstChild(TreeNode node)
Get the first child of the TreeNode.
|
TreeNode |
getNextSibling(TreeNode node)
Get the next sibling of the TreeNode.
|
private int |
getOffset(int index)
The idx file contains offsets into the dat file.
|
TreeNode |
getParent(TreeNode node)
Get the parent of the TreeNode.
|
TreeNode |
getRoot() |
private TreeNode |
getTreeNode(int offset)
Given an offset get the TreeNode from the dat file.
|
private static final String EXTENSION_INDEX
private static final String EXTENSION_DATA
private SwordBookMetaData bmd
private File idxFile
private File datFile
private RandomAccessFile idxRaf
private RandomAccessFile datRaf
private boolean active
private static final org.slf4j.Logger log
public TreeKeyIndex(SwordBookMetaData sbmd)
sbmd - public TreeNode getRoot() throws IOException
IOExceptionpublic TreeNode getParent(TreeNode node) throws IOException
node - the node being worked uponIOExceptionpublic TreeNode getFirstChild(TreeNode node) throws IOException
node - the node being worked uponIOExceptionpublic TreeNode getNextSibling(TreeNode node) throws IOException
node - the node being worked uponIOExceptionprivate int getOffset(int index)
throws IOException
index - the record idIOExceptionprivate TreeNode getTreeNode(int offset) throws IOException
offset - start of a TreeNode record in the dat file.IOExceptionpublic final void activate(Lock lock)
Activatableactivate in interface Activatablelock - An attempt to ensure that only the Activator calls this methodpublic final void deactivate(Lock lock)
Activatabledeactivate in interface Activatablelock - An attempt to ensure that only the Activator calls this methodprotected final void checkActive()
private String getExpandedDataPath() throws BookException
BookException