Interface TraversableTree<E>

Type Parameters:
E - The type of the values stored in the tree.
All Known Implementing Classes:
TraversableNodeTree

public interface TraversableTree<E>
A tree that can be traversed by a path in form of directory-like structure.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if there is a node at the given path.
    Returns the value of the currently visited node.
    get(String path)
    Returns the value of the tree at the given path.
    void
    insert(@NotNull String path, E value)
    Inserts a value at the given path.
    Returns the value of the root node.
    Traverses the tree to the given path.
  • Method Details

    • root

      @Nullable E root()
      Returns the value of the root node.
      Returns:
      The value of the root node.
    • traverse

      @Nullable E traverse(String path)
      Traverses the tree to the given path. The current node will be set to the node at the given path.
      Parameters:
      path - The path to traverse to.
      Returns:
      The value at the given path, or null if the path does not exist.
    • get

      @Nullable E get(String path)
      Returns the value of the tree at the given path.
      Parameters:
      path - The path to traverse to.
      Returns:
      The value at the given path, or null if the path does not exist.
    • containsPath

      boolean containsPath(String path)
      Checks if there is a node at the given path.
    • current

      @Nullable E current()
      Returns the value of the currently visited node.
      Returns:
      The value of the current node.
    • insert

      void insert(@NotNull @NotNull String path, @NotNull E value)
      Inserts a value at the given path. If the path does not exist, it will be created.

      If the path already exists, the value will be overwritten.

      Parameters:
      path - The path to insert the value at.
      value - The value to insert.