Lvg Java
2006p Version

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

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

public class PersistentList
extends java.lang.Object

This class provides a mechanism for persistent linked list. One persistent file is capable of storing multiple linked lists. However, the store procedure (adding nodes) need to be done at one time consequencially for one linked list.

The file format is:
header + node1 + node2 + ...
where header is:


node:

History:

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

Field Summary
static int HEADER_OFFSET
          the size of header used in binary file
 
Constructor Summary
PersistentList(java.lang.String path)
          Create an object of persistent list, using a string for the path of the binary file to be strored.
 
Method Summary
 void Add(PersistentListNode node)
          Add a persistent node to the current persistent list.
 void Close()
          Close the random access file of current persistent list.
 long GetAddress()
          Get the beginning address of current persistent list.
 java.io.RandomAccessFile GetRaf()
          Get the random access file of the current persistent list.
static void main(java.lang.String[] args)
          A test driver for this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEADER_OFFSET

public static final int HEADER_OFFSET
the size of header used in binary file

See Also:
Constant Field Values
Constructor Detail

PersistentList

public PersistentList(java.lang.String path)
Create an object of persistent list, using a string for the path of the binary file to be strored.

Method Detail

Add

public void Add(PersistentListNode node)
         throws java.io.IOException
Add a persistent node to the current persistent list.

Parameters:
node - the persistent node to be added
Throws:
java.io.IOException - if probelms happens when accessing random access file

GetAddress

public long GetAddress()
Get the beginning address of current persistent list.

Returns:
the beginning address of current persistent list

GetRaf

public java.io.RandomAccessFile GetRaf()
Get the random access file of the current persistent list.

Returns:
the random access file of the current persistent list

Close

public void Close()
           throws java.io.IOException
Close the random access file of current persistent list.

Throws:
java.io.IOException - if probelms happens when closing random access file

main

public static void main(java.lang.String[] args)
A test driver for this class.


Lvg Java
2006p Version

Submit a bug or feature

Copyright © 2006p National Library of Medicine