|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.util.datastruct.v1.PathRegistry
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.
Constructor Summary | |
PathRegistry(char separator,
boolean ignoreDuplicateSeparators)
Users must specify all variables without corresponding defaults. |
Method Summary | |
protected void |
addChildNode(net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode parent,
net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode child)
Child must already be initialized correctly. |
protected net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode |
findNode(java.lang.String name)
Find the node with the given name. |
protected net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode |
findSibling(net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode parent,
java.lang.String namePart)
Find the sibling with the given node name part. |
java.lang.Object |
get(java.lang.String path)
Retrieve the object stored at the given path. |
protected java.util.Enumeration |
parsePath(java.lang.String path)
Parses the given path into node elements. |
void |
register(java.lang.String path,
java.lang.Object value,
boolean isRecursive,
boolean isCaseSensitive)
Register the given object at the given path. |
void |
remove(java.lang.String path)
Remove the object at the given path. |
protected void |
removeChild(net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode parent,
net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode child)
Find the sibling with the given node name part. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PathRegistry(char separator, boolean ignoreDuplicateSeparators)
Method Detail |
public void register(java.lang.String path, java.lang.Object value, boolean isRecursive, boolean isCaseSensitive) throws PathAlreadyRegisteredException
For future use, we will need to re-do synchronization, so that we synch on the tree node parent being worked on.
path
- the path under which the given value will be registered.value
- the object to store under the given path.isRecursive
- set to true
to notify the tree that
this particular node also covers any sub-paths. If this is
false
, then queries will only retrieve this
node if the exact path is given.isCaseSensitive
- set to true
if the given node is
to be case sensitive in searches. If the nodes leading to this
new node do not exist, then the newly created nodes will have the
same case sensitivity as this end node.
java.lang.IllegalArgumentException
- thrown if the value is
null
, or the given path is not well formed.
PathAlreadyRegisteredException
- thrown if the given path
has already been registered to another object.public void remove(java.lang.String path) throws NoRegisteredComponentException
For future use, we will need to re-do synchronization, so that we synch on the tree node parent being worked on.
path
- the tree path specifying which node to remove. If the
given node does not exist, or has not been registered, then a
NotRegisteredException is thrown.
java.lang.IllegalArgumentException
- thrown if the value is
null
, or the given path is not well formed.
NoRegisteredComponentException
- thrown if the given path node
has not yet been registered.public java.lang.Object get(java.lang.String path)
Need to synchronize better so that reads don't collide with writes, but reads can be done asynchronously.
path
- the path which specifies the object to retrieve.
null
if nothing is registered there.protected java.util.Enumeration parsePath(java.lang.String path)
protected net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode findSibling(net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode parent, java.lang.String namePart)
protected net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode findNode(java.lang.String name)
protected void removeChild(net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode parent, net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode child)
protected void addChildNode(net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode parent, net.sourceforge.groboutils.util.datastruct.v1.PathRegistry.TreeNode child) throws PathAlreadyRegisteredException
PathAlreadyRegisteredException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |