Lvg Java
2006p Version

gov.nih.nlm.nls.lvg.Trie
Class PersistentTrieNode

java.lang.Object
  extended by gov.nih.nlm.nls.lvg.Trie.PersistentTreeNode
      extended by gov.nih.nlm.nls.lvg.Trie.PersistentTrieNode

public class PersistentTrieNode
extends PersistentTreeNode

This class creates an object of persistent trie node.

History:

Version:
V-2006p
Author:
NLM NLS Development Team
See Also:
Design Document

Constructor Summary
PersistentTrieNode(char key, long ruleAddress)
          Create an object of persistent tree node, using key (a character from suffix) and the address of a rule.
PersistentTrieNode(int level, long parent, long next, long child, long address)
          Create an object of persistent trie node, using an address, next address, parent address, child address in a random access file and level at the persistent tree.
PersistentTrieNode(long address)
          Create an object of persistent trie node, using an address in a random access file.
 
Method Summary
 char GetKey()
          Get the key of current trie node.
static PersistentTreeNode GetNode(java.io.RandomAccessFile raf, long address)
          Get the current persistent trie node from a specified binary file at a specified address.
 long GetRuleAddress()
          Get the rule address of current trie node.
static int PrintNode(java.io.RandomAccessFile trieRaf, long address, java.lang.String rulePath, java.lang.String exceptionPath)
          Print all sub tree (list) for a persistent trie node at a specific address of a specific binary file.
 void ReadData(java.io.RandomAccessFile raf)
          Read data from the random access file.
 void WriteData(java.io.RandomAccessFile raf)
          Write data to the random access file.
 
Methods inherited from class gov.nih.nlm.nls.lvg.Trie.PersistentTreeNode
GetAddress, GetChild, GetLevel, GetNext, GetParent, PrintNode, SetAddress, SetChild, SetLevel, SetNext, SetParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentTrieNode

public PersistentTrieNode(long address)
Create an object of persistent trie node, using an address in a random access file.


PersistentTrieNode

public PersistentTrieNode(char key,
                          long ruleAddress)
Create an object of persistent tree node, using key (a character from suffix) and the address of a rule. In a LVG trie, each node is a character from the suffix. This character is called key.


PersistentTrieNode

public PersistentTrieNode(int level,
                          long parent,
                          long next,
                          long child,
                          long address)
Create an object of persistent trie node, using an address, next address, parent address, child address in a random access file and level at the persistent tree.

Method Detail

GetKey

public char GetKey()
Get the key of current trie node.

Returns:
key of current trie node

GetRuleAddress

public long GetRuleAddress()
Get the rule address of current trie node.

Returns:
rule address of current trie node

WriteData

public void WriteData(java.io.RandomAccessFile raf)
               throws java.io.IOException
Write data to the random access file.

Overrides:
WriteData in class PersistentTreeNode
Parameters:
raf - the random access file that data will be written to
Throws:
java.io.IOException - if problems happen when accessing the random access file.

ReadData

public void ReadData(java.io.RandomAccessFile raf)
              throws java.io.IOException
Read data from the random access file.

Overrides:
ReadData in class PersistentTreeNode
Parameters:
raf - the random access file that data will be read from
Throws:
java.io.IOException - if problems happen when accessing the random access file.

GetNode

public static PersistentTreeNode GetNode(java.io.RandomAccessFile raf,
                                         long address)
                                  throws java.io.IOException
Get the current persistent trie node from a specified binary file at a specified address.

Parameters:
raf - the binary file that the persistent node will be retrieved from
address - the address in the binary file that the persistent node will be retrieved from
Throws:
java.io.IOException - if problems happen when accessing the random access file.

PrintNode

public static int PrintNode(java.io.RandomAccessFile trieRaf,
                            long address,
                            java.lang.String rulePath,
                            java.lang.String exceptionPath)
                     throws java.io.IOException
Print all sub tree (list) for a persistent trie node at a specific address of a specific binary file. The print out information includes the key, rules, and exceptions.

Parameters:
trieRaf - the binary file that the persistent trie node will be printed out
address - the address in the binary file that the persistent trie node will be printed out
rulePath - the path/name of the LVG persistent rule
exceptionPath - the path/name of the LVG persistent exception
Throws:
java.io.IOException - if problems happen when accessing the random access file.

Lvg Java
2006p Version

Submit a bug or feature

Copyright © 2006p National Library of Medicine