org.apache.zookeeper.common
Class PathTrie

java.lang.Object
  extended by org.apache.zookeeper.common.PathTrie

public class PathTrie
extends Object

a class that implements prefix matching for components of a filesystem path. the trie looks like a tree with edges mapping to the component of a path. example /ab/bc/cf would map to a trie / ab/ (ab) bc/ / (bc) cf/ (cf)


Constructor Summary
PathTrie()
          construct a new PathTrie with a root node of /
 
Method Summary
 void addPath(String path)
          add a path to the path trie
 void deletePath(String path)
          delete a path from the trie
 String findMaxPrefix(String path)
          return the largest prefix for the input path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathTrie

public PathTrie()
construct a new PathTrie with a root node of /

Method Detail

addPath

public void addPath(String path)
add a path to the path trie

Parameters:
path -

deletePath

public void deletePath(String path)
delete a path from the trie

Parameters:
path - the path to be deleted

findMaxPrefix

public String findMaxPrefix(String path)
return the largest prefix for the input path.

Parameters:
path - the input path
Returns:
the largest prefix for the input path.


Copyright © 2011 The Apache Software Foundation