Class MapBasedPrinter.ExprTreeVisitor
- java.lang.Object
-
- ru.ispras.fortress.expression.ExprTreeVisitorDefault
-
- ru.ispras.fortress.expression.printer.MapBasedPrinter.ExprTreeVisitor
-
- All Implemented Interfaces:
ExprTreeVisitor
,TreeVisitor
- Direct Known Subclasses:
JavaExprPrinter.Visitor
,SmtExprPrinter.Visitor
,TextExprPrinter.Visitor
- Enclosing class:
- MapBasedPrinter
protected class MapBasedPrinter.ExprTreeVisitor extends ExprTreeVisitorDefault
This class implements an expression tree visitor that prints an expression by using a map of operation identifiers to operation descriptions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ru.ispras.fortress.util.TreeVisitor
TreeVisitor.Status
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExprTreeVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendText(java.lang.String text)
Appends text to the string representation of the expression tree.int[]
getOperandOrder()
Returns an array of operand indexes that specify in which order the operands of the currently visited operator should be visited.void
onOperandBegin(NodeOperation expr, Node operand, int index)
Notifies that visiting an expression operand has started.void
onOperationBegin(NodeOperation expr)
Starts visiting an operation node.void
onOperationEnd(NodeOperation expr)
Finishes visiting an operation node.void
onValue(NodeValue value)
Notifies that a value node has been visited.void
onVariable(NodeVariable variable)
Notifies that a variable node has been visited.java.lang.String
toString()
Returns the string representation of the expression tree.-
Methods inherited from class ru.ispras.fortress.expression.ExprTreeVisitorDefault
getStatus, onBegin, onBindingBegin, onBindingEnd, onBindingListEnd, onBoundVariableBegin, onBoundVariableEnd, onEnd, onOperandEnd, setStatus
-
-
-
-
Method Detail
-
appendText
protected final void appendText(java.lang.String text)
Appends text to the string representation of the expression tree.- Parameters:
text
- Text to be appended.
-
toString
public final java.lang.String toString()
Returns the string representation of the expression tree.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of the expression tree.
-
onOperationBegin
public void onOperationBegin(NodeOperation expr)
Description copied from interface:ExprTreeVisitor
Starts visiting an operation node.- Specified by:
onOperationBegin
in interfaceExprTreeVisitor
- Overrides:
onOperationBegin
in classExprTreeVisitorDefault
- Parameters:
expr
- Operation node.
-
getOperandOrder
public int[] getOperandOrder()
Description copied from interface:ExprTreeVisitor
Returns an array of operand indexes that specify in which order the operands of the currently visited operator should be visited. If the order is standard (i.e. [0..N-1]),null
is returned.- Specified by:
getOperandOrder
in interfaceExprTreeVisitor
- Overrides:
getOperandOrder
in classExprTreeVisitorDefault
- Returns:
- Array of operand indexes or
null
for the standard order.
-
onOperationEnd
public void onOperationEnd(NodeOperation expr)
Description copied from interface:ExprTreeVisitor
Finishes visiting an operation node.- Specified by:
onOperationEnd
in interfaceExprTreeVisitor
- Overrides:
onOperationEnd
in classExprTreeVisitorDefault
- Parameters:
expr
- Operation node.
-
onOperandBegin
public void onOperandBegin(NodeOperation expr, Node operand, int index)
Description copied from interface:ExprTreeVisitor
Notifies that visiting an expression operand has started.- Specified by:
onOperandBegin
in interfaceExprTreeVisitor
- Overrides:
onOperandBegin
in classExprTreeVisitorDefault
- Parameters:
expr
- Operation node.operand
- Operand node.index
- Operand index.
-
onValue
public void onValue(NodeValue value)
Description copied from interface:ExprTreeVisitor
Notifies that a value node has been visited.- Specified by:
onValue
in interfaceExprTreeVisitor
- Overrides:
onValue
in classExprTreeVisitorDefault
- Parameters:
value
- Value node.
-
onVariable
public void onVariable(NodeVariable variable)
Description copied from interface:ExprTreeVisitor
Notifies that a variable node has been visited.- Specified by:
onVariable
in interfaceExprTreeVisitor
- Overrides:
onVariable
in classExprTreeVisitorDefault
- Parameters:
variable
- Variable node.
-
-