use of com.alibaba.maxgraph.compiler.tree.UnaryTreeNode in project GraphScope by alibaba.
the class TreeNodeUtils method buildTreeNodeListFromLeaf.
/**
* Parse tree node list from leaf node
*
* @param leafNode The given leaf node
* @return The tree node list
*/
public static List<TreeNode> buildTreeNodeListFromLeaf(TreeNode leafNode) {
TreeNode currentNode = leafNode;
LinkedList<TreeNode> treeNodeList = Lists.newLinkedList();
while (!(currentNode instanceof SourceTreeNode)) {
treeNodeList.addFirst(currentNode);
currentNode = ((UnaryTreeNode) currentNode).getInputNode();
}
treeNodeList.addFirst(currentNode);
return treeNodeList;
}
Aggregations