java.lang.Object
org.neo4j.cypherdsl.core.TreeNode<E>
- Type Parameters:
E
- The type of each node value
A mutable tree structure providing Breadth-first
search (aka in-level order traversal) and pre-ordered depth-first search. This class is thread-safe.
- Since:
- 2023.2.0
- Author:
- Michael J. Simons
-
Method Details
-
from
Creates a tree from aStatement
. This allows to visit all elements of statement without implementing customvisitors.
The root of the returned tree will always be the statement.- Parameters:
statement
- The statement that should be represented as a tree- Returns:
- A tree with the statement as root
-
isRoot
public boolean isRoot()- Returns:
- true if this is the root node
-
getLevel
public int getLevel()- Returns:
- The level or the height in this tree (0 is the level of the root node)
-
getParent
- Returns:
- The parent of this node or null if this is a root node.
-
getChildren
- Returns:
- An immutable collection of this nodes children
-
getValue
- Returns:
- The value of this node.
-
breadthFirst
- Returns:
- a breadth-first iterator of this node and it's children
-
preOrder
- Returns:
- a depth-first, pre-ordered iterator of this node and it's children
-
printTo
Creates an ASCII representation of this node and its children- Parameters:
target
- The target to which to print this tree totoString
- How to format nodes if this type
-