DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.standards
Class TreeCache

java.lang.Object
  extended by org.dlese.dpc.schemedit.standards.TreeCache

public class TreeCache
extends Object

Cashe of AsnStandardsDocuments. Works with a StandardsRegistry instance to support the "getStandardsDocument" call. Maintains a tree map of specified size. When a call to getStandardsDocument is called: - Most recently used list is updated to put that tree first. - if requested tree is not in the tree map, the least recently used tree is destroyed and the requested tree is read (using path obtained from the Registry).

Author:
Jonathan Ostwald

Constructor Summary
TreeCache(StandardsRegistry standardsRegistry)
          Constructor for the TreeCache object
 
Method Summary
 void addTree(String key, AsnStandardsDocument tree)
          Description of the Method
 AsnStandardsNode getStandardsNode(String asnId)
          Gets the standardsNode attribute of the TreeCache object
 AsnStandardsNode getStandardsNodeOLD(String asnId)
          Gets the standardsNode attribute of the TreeCache object
 AsnStandardsDocument getTree(String key)
          Get the StandardsTree specified by provided key.
 boolean isFull()
          Gets the full attribute of the TreeCache object
static void main(String[] args)
          The main program for the TreeCache class
 void removeTree()
          Remove least recently used tree from the cache
 void removeTree(String key)
          Remove specified tree from the cache
 void report()
          NOT YET DOCUMENTED
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeCache

public TreeCache(StandardsRegistry standardsRegistry)
          throws Exception
Constructor for the TreeCache object

Parameters:
standardsRegistry - NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED
Method Detail

addTree

public void addTree(String key,
                    AsnStandardsDocument tree)
Description of the Method

Parameters:
key - Document key of the form (...)
tree - Description of the Parameter

isFull

public boolean isFull()
Gets the full attribute of the TreeCache object

Returns:
The full value

removeTree

public void removeTree()
Remove least recently used tree from the cache


removeTree

public void removeTree(String key)
Remove specified tree from the cache

Parameters:
key - key of asnStandardsDocument

getTree

public AsnStandardsDocument getTree(String key)
Get the StandardsTree specified by provided key.
 if the treeMap.containsKey(key)
 - usageQueue.touch(key)
 otherwise
 - tree = new AsnStandardsDocument (key)
 - addTree (key, tree)
 return  treeMap.get(key)

Parameters:
key - document key (e.g., "AAAS.Science.1993.D1000152")
Returns:
The the standards document for specified key.

getStandardsNodeOLD

public AsnStandardsNode getStandardsNodeOLD(String asnId)
Gets the standardsNode attribute of the TreeCache object

Parameters:
asnId - Description of the Parameter
Returns:
The standardsNode value

getStandardsNode

public AsnStandardsNode getStandardsNode(String asnId)
                                  throws Exception
Gets the standardsNode attribute of the TreeCache object

Parameters:
asnId - NOT YET DOCUMENTED
Returns:
The standardsNode value
Throws:
Exception - NOT YET DOCUMENTED

report

public void report()
NOT YET DOCUMENTED


main

public static void main(String[] args)
                 throws Exception
The main program for the TreeCache class

Parameters:
args - The command line arguments
Throws:
Exception - NOT YET DOCUMENTED

DLESE Tools
v1.6.0