Package org.apache.zookeeper.common
Class PathTrie
- java.lang.Object
-
- org.apache.zookeeper.common.PathTrie
-
public class PathTrie extends java.lang.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
Constructors Constructor Description PathTrie()
construct a new PathTrie with a root node of /
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPath(java.lang.String path)
add a path to the path trievoid
clear()
clear all nodesvoid
deletePath(java.lang.String path)
delete a path from the triejava.lang.String
findMaxPrefix(java.lang.String path)
return the largest prefix for the input path.
-
-
-
Method Detail
-
addPath
public void addPath(java.lang.String path)
add a path to the path trie- Parameters:
path
-
-
deletePath
public void deletePath(java.lang.String path)
delete a path from the trie- Parameters:
path
- the path to be deleted
-
findMaxPrefix
public java.lang.String findMaxPrefix(java.lang.String path)
return the largest prefix for the input path.- Parameters:
path
- the input path- Returns:
- the largest prefix for the input path.
-
clear
public void clear()
clear all nodes
-
-