|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.book.sword.TreeKeyIndex
public class TreeKeyIndex
TreeKeyIndex reads Sword index files that are path based. Paths are of the form /a/b/c, and can be of any depth. The ultimate output of a TreeKeyIndex is the offset and length of a chunk of data in another file that can be read.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
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 Logger |
log
The log stream |
Constructor Summary | |
---|---|
TreeKeyIndex(SwordBookMetaData sbmd)
Simple ctor |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 Logger log
Constructor Detail |
---|
public TreeKeyIndex(SwordBookMetaData sbmd) throws BookException
BookException
Method Detail |
---|
public TreeNode getRoot() throws IOException
IOException
public TreeNode getParent(TreeNode node) throws IOException
node
- the node being worked upon
IOException
public TreeNode getFirstChild(TreeNode node) throws IOException
node
- the node being worked upon
IOException
public TreeNode getNextSibling(TreeNode node) throws IOException
node
- the node being worked upon
IOException
private int getOffset(int index) throws IOException
index
- the record id
IOException
private TreeNode getTreeNode(int offset) throws IOException
offset
- start of a TreeNode record in the dat file.
IOException
public final void activate(Lock lock)
Activatable
activate
in interface Activatable
lock
- An attempt to ensure that only the Activator calls this methodpublic final void deactivate(Lock lock)
Activatable
deactivate
in interface Activatable
lock
- An attempt to ensure that only the Activator calls this methodprotected final void checkActive()
private String getExpandedDataPath() throws BookException
BookException
|
Copyright ยจ 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |