Package org.fulib.fx.data
Class TraversableNodeTree<E>
java.lang.Object
org.fulib.fx.data.TraversableNodeTree<E>
- Type Parameters:
E- The type of the values stored in the tree.
- All Implemented Interfaces:
TraversableTree<E>
A tree that can be traversed by a path in form of directory-like structure implemented using nodes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA node for representing a tree. -
Constructor Summary
Constructors -
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.voidTraverses the tree to the given path.
-
Constructor Details
-
TraversableNodeTree
public TraversableNodeTree()Creates a new traversable tree.
-
-
Method Details
-
root
Description copied from interface:TraversableTreeReturns the value of the root node.- Specified by:
rootin interfaceTraversableTree<E>- Returns:
- The value of the root node.
-
traverse
Description copied from interface:TraversableTreeTraverses the tree to the given path. The current node will be set to the node at the given path.- Specified by:
traversein interfaceTraversableTree<E>- Parameters:
path- The path to traverse to.- Returns:
- The value at the given path, or null if the path does not exist.
-
get
Description copied from interface:TraversableTreeReturns the value of the tree at the given path.- Specified by:
getin interfaceTraversableTree<E>- Parameters:
path- The path to traverse to.- Returns:
- The value at the given path, or null if the path does not exist.
-
containsPath
Description copied from interface:TraversableTreeChecks if there is a node at the given path.- Specified by:
containsPathin interfaceTraversableTree<E>
-
current
Description copied from interface:TraversableTreeReturns the value of the currently visited node.- Specified by:
currentin interfaceTraversableTree<E>- 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 starts with a slash, the root node will be used as the starting point.
If the path does not start with a slash, the current node will be used as the starting point.
- Specified by:
insertin interfaceTraversableTree<E>- Parameters:
path- The path to insert the value at.value- The value to insert.
-
currentNode
-
setCurrentNode
-