Package edu.caltech.nanodb.expressions
Interface ExpressionProcessor
-
- All Known Implementing Classes:
Expression.SymbolFinder
,SubquerySchemaComputer
public interface ExpressionProcessor
This interface is used to implement scans or transformations of expression trees by specifying what to do when entering or leaving each expression node. When leaving an expression node, a replacement expression may be returned that will replace the expression node that was just left.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
enter(Expression node)
This method is called when expression-traversal is entering a particular node in the expression tree.Expression
leave(Expression node)
This method is called when expression-traversal is leaving a particular node in the expression tree.
-
-
-
Method Detail
-
enter
void enter(Expression node)
This method is called when expression-traversal is entering a particular node in the expression tree. It is not possible to replace a node when entering it, because this would unnecessarily complicate the semantics of expression-tree traversal.- Parameters:
node
- theExpression
node being entered
-
leave
Expression leave(Expression node)
This method is called when expression-traversal is leaving a particular node in the expression tree. To facilitate mutation of expression trees, this method must return anExpression
object: If the expression processor wants to replace the node being left with a different node, this method can return the replacement node; otherwise, the method should return the passed-in node.- Parameters:
node
- theExpression
node being left- Returns:
- the
Expression
object to use for the node being left; eithernode
if no changes are to be made, or a newExpression
object ifnode
should be replaced.
-
-