Package ru.ispras.fortress.expression
Class ExprTreeWalker
- java.lang.Object
-
- ru.ispras.fortress.expression.ExprTreeWalker
-
public final class ExprTreeWalker extends java.lang.Object
TheExprTreeWalker
class provides methods that traverse an expression tree and apply a visitor to its nodes. The protocol used for traversal is explained here.
-
-
Constructor Summary
Constructors Constructor Description ExprTreeWalker(ExprTreeVisitor visitor)
Constructs an ExprTreeWalker object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
visit(java.lang.Iterable<? extends Node> trees)
Visits a sequence of expression trees.void
visit(Node tree)
Visits the specified expression node.void
visitNode(Node node)
Visits the specified node.
-
-
-
Constructor Detail
-
ExprTreeWalker
public ExprTreeWalker(ExprTreeVisitor visitor)
Constructs an ExprTreeWalker object.- Parameters:
visitor
- Visitor to be applied to tree nodes.- Throws:
java.lang.IllegalArgumentException
- if the visitor parameter is null.
-
-
Method Detail
-
visit
public void visit(java.lang.Iterable<? extends Node> trees)
Visits a sequence of expression trees. Each node in the sequence is considered a root of an expression tree and the visitor is notified about it by calls to the onRootBegin and onRootEnd methods.- Parameters:
trees
- A sequence of expression trees to be visited.- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null; if any of the child nodes of the expression nodes in the sequence has a unknown type.
-
visit
public void visit(Node tree)
Visits the specified expression node. The visited node is considered a root of an expression tree and the visitor is notified about it by calls to the onRootBegin and onRootEnd methods.- Parameters:
tree
- Expression tree to be visited.- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null; if any of the expression tree nodes has a unknown type.
-
visitNode
public void visitNode(Node node)
Visits the specified node.- Parameters:
node
- Node to be visited.- Throws:
java.lang.IllegalArgumentException
- if the parameter equals null; if the node or any of its child nodes has a unknown type.
-
-