public class TreeCache
extends java.lang.Object
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).Constructor and Description |
---|
TreeCache(StandardsRegistry standardsRegistry)
Constructor for the TreeCache object
|
Modifier and Type | Method and Description |
---|---|
void |
addTree(java.lang.String key,
AsnStandardsDocument tree)
Description of the Method
|
AsnStandardsNode |
getStandardsNode(java.lang.String asnId)
Gets the standardsNode attribute of the TreeCache object
|
AsnStandardsNode |
getStandardsNodeOLD(java.lang.String asnId)
Gets the standardsNode attribute of the TreeCache object
|
AsnStandardsDocument |
getTree(java.lang.String key)
Get the StandardsTree specified by provided key.
|
boolean |
isFull()
Gets the full attribute of the TreeCache object
|
static void |
main(java.lang.String[] args)
The main program for the TreeCache class
|
void |
removeTree()
Remove least recently used tree from the cache
|
void |
removeTree(java.lang.String key)
Remove specified tree from the cache
|
void |
report()
NOT YET DOCUMENTED
|
public TreeCache(StandardsRegistry standardsRegistry) throws java.lang.Exception
standardsRegistry
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic void addTree(java.lang.String key, AsnStandardsDocument tree)
key
- Document key of the form (tree
- Description of the Parameterpublic boolean isFull()
public void removeTree()
public void removeTree(java.lang.String key)
key
- key of asnStandardsDocumentpublic AsnStandardsDocument getTree(java.lang.String key)
if the treeMap.containsKey(key) - usageQueue.touch(key) otherwise - tree = new AsnStandardsDocument (key) - addTree (key, tree) return treeMap.get(key)
key
- document key (e.g., "AAAS.Science.1993.D1000152")public AsnStandardsNode getStandardsNodeOLD(java.lang.String asnId)
asnId
- Description of the Parameterpublic AsnStandardsNode getStandardsNode(java.lang.String asnId) throws java.lang.Exception
asnId
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic void report()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command line argumentsjava.lang.Exception
- NOT YET DOCUMENTED