Package org.fulib.fx.data
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 TypeMethodDescriptionbooleancontainsPath(String path) Checks if there is a node at the given path.current()Returns the value of the currently visited node.Returns the value of the tree at the given path.voidInserts a value at the given path.root()Returns the value of the root node.Traverses the tree to the given path.
-
Method Details
-
root
Returns the value of the root node.- Returns:
- The value of the root node.
-
traverse
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
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
Checks if there is a node at the given path. -
current
Returns the value of the currently visited node.- Returns:
- The value of the current node.
-
insert
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.
-