| java.lang.Object net.sourceforge.groboutils.util.datastruct.v1.PathRegistry
PathRegistry | public class PathRegistry (Code) | | A path-tree registry for storing and retrieving objects. Objects can
be registered at any point along the tree, but no more than one object
may be at each node. A null entry at a point indicates
a non-registered node.
Synchronization needs to be hauled-over to increase speed and minimize
read interference with writes.
author: Matt Albrecht groboclown@users.sourceforge.net since: April 26, 2000 (0.9.0 Alpha) version: $Date: 2003/02/10 22:52:44 $ |
Inner Class :class TreeNode | |
Constructor Summary | |
public | PathRegistry(char separator, boolean ignoreDuplicateSeparators) Users must specify all variables without corresponding defaults. |
Method Summary | |
protected void | addChildNode(TreeNode parent, TreeNode child) Child must already be initialized correctly. | protected TreeNode | findNode(String name) Find the node with the given name. | protected TreeNode | findSibling(TreeNode parent, String namePart) Find the sibling with the given node name part. | public synchronized Object | get(String path) Retrieve the object stored at the given path.
Need to synchronize better so that reads don't collide with writes,
but reads can be done asynchronously.
Parameters: path - the path which specifies the object to retrieve. | protected Enumeration | parsePath(String path) Parses the given path into node elements. | public synchronized void | register(String path, Object value, boolean isRecursive, boolean isCaseSensitive) Register the given object at the given path. | public synchronized void | remove(String path) Remove the object at the given path. | protected void | removeChild(TreeNode parent, TreeNode child) Find the sibling with the given node name part. |
PathRegistry | public PathRegistry(char separator, boolean ignoreDuplicateSeparators)(Code) | | Users must specify all variables without corresponding defaults. This
prevents the class from implementing defaults, which have a habit of
randomly changing.
|
findNode | protected TreeNode findNode(String name)(Code) | | Find the node with the given name.
|
findSibling | protected TreeNode findSibling(TreeNode parent, String namePart)(Code) | | Find the sibling with the given node name part.
|
get | public synchronized Object get(String path)(Code) | | Retrieve the object stored at the given path.
Need to synchronize better so that reads don't collide with writes,
but reads can be done asynchronously.
Parameters: path - the path which specifies the object to retrieve. the object which was registered at the given path, ornull if nothing is registered there. |
parsePath | protected Enumeration parsePath(String path)(Code) | | Parses the given path into node elements. The last item in the list is
ignored, unless the path ends with the path separator character.
|
register | public synchronized void register(String path, Object value, boolean isRecursive, boolean isCaseSensitive) throws PathAlreadyRegisteredException(Code) | | Register the given object at the given path. If the nodes leading
up to this end node do not exist, then they will be created.
For future use, we will need to re-do synchronization, so that
we synch on the tree node parent being worked on.
Parameters: path - the path under which the given value will be registered. Parameters: value - the object to store under the given path. Parameters: isRecursive - set to true to notify the tree thatthis particular node also covers any sub-paths. If this isfalse , then queries will only retrieve thisnode if the exact path is given. Parameters: isCaseSensitive - set to true if the given node isto be case sensitive in searches. If the nodes leading to thisnew node do not exist, then the newly created nodes will have thesame case sensitivity as this end node. exception: IllegalArgumentException - thrown if the value isnull , or the given path is not well formed. exception: PathAlreadyRegisteredException - thrown if the given pathhas already been registered to another object. |
remove | public synchronized void remove(String path) throws NoRegisteredComponentException(Code) | | Remove the object at the given path. It only removes nodes
if the node no longer has any children. The siblings
are automatically compressed.
For future use, we will need to re-do synchronization, so that
we synch on the tree node parent being worked on.
Parameters: path - the tree path specifying which node to remove. If thegiven node does not exist, or has not been registered, then aNotRegisteredException is thrown. exception: IllegalArgumentException - thrown if the value isnull , or the given path is not well formed. exception: NoRegisteredComponentException - thrown if the given path nodehas not yet been registered. |
removeChild | protected void removeChild(TreeNode parent, TreeNode child)(Code) | | Find the sibling with the given node name part.
|
|
|