PathTrie (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.common

## Class PathTrie

- java.lang.Object
- - 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

    Constructors
    Constructor and Description
    `PathTrie()` Construct a new PathTrie with a root node.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPath(String path)` Add a path to the path trie.
    `void` | `clear()` Clear all nodes in the trie.
    `void` | `deletePath(String path)` Delete a path from the trie.
    `boolean` | `existsNode(String path)` Return true if the given path exists in the trie, otherwise return false; All paths are relative to the root node.
    `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.

  - ### Method Detail

    - #### addPath

          public void addPath(String path)

      Add a path to the path trie. All paths are relative to the root node.
      Parameters:
        `path` - the path to add to the trie

    - #### deletePath

          public void deletePath(String path)

      Delete a path from the trie. All paths are relative to the root node.
      Parameters:
        `path` - the path to be deleted

    - #### existsNode

          public boolean existsNode(String path)

      Return true if the given path exists in the trie, otherwise return false; All paths are relative to the root node.
      Parameters:
        `path` - the input path
      Returns:
        the largest prefix for the

    - #### findMaxPrefix

          public String findMaxPrefix(String path)

      Return the largest prefix for the input path. All paths are relative to the root node.
      Parameters:
        `path` - the input path
      Returns:
        the largest prefix for the input path

    - #### clear

          public void clear()

      Clear all nodes in the trie.

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.