|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.data.expr.AbstractParseTreeVisitor
ptolemy.data.expr.ParseTreeFreeVariableRenamer
public class ParseTreeFreeVariableRenamer
This class visits parse trees and renames the free variables that match a specified variable. Use this class prior to changing the name of a variable to update references to the variable.
ASTPtRootNode
| Red (cxh) |
| Yellow (eal) |
| Field Summary | |
|---|---|
protected Variable |
_dependentVariable
The variable to which the parse tree belongs. |
protected java.util.Set |
_formalParameters
Formal parameters within a function definition. |
protected java.lang.String |
_name
The new name. |
protected ParserScope |
_scope
The scope. |
protected Variable |
_variableToRename
The variable to be renamed. |
| Constructor Summary | |
|---|---|
ParseTreeFreeVariableRenamer()
|
|
| Method Summary | |
|---|---|
protected java.util.Collection |
_intersection(java.util.Collection collection1,
java.util.Collection collection2)
Return the intersection of two collections. |
protected void |
_visitAllChildren(ASTPtRootNode node)
Loop through all of the children of this node, visiting each one of them, which will cause their token value to be determined. |
protected void |
_visitChild(ASTPtRootNode node,
int i)
Visit the child with the given index of the given node. |
void |
renameVariables(ASTPtRootNode node,
Variable dependentVariable,
Variable variableToRename,
java.lang.String name)
Rename the variables, if any, in the dependentVariable that refer to the specified variableToRename. |
void |
visitArrayConstructNode(ASTPtArrayConstructNode node)
|
void |
visitBitwiseNode(ASTPtBitwiseNode node)
|
void |
visitFunctionalIfNode(ASTPtFunctionalIfNode node)
|
void |
visitFunctionApplicationNode(ASTPtFunctionApplicationNode node)
|
void |
visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node)
|
void |
visitLeafNode(ASTPtLeafNode node)
|
void |
visitLogicalNode(ASTPtLogicalNode node)
|
void |
visitMatrixConstructNode(ASTPtMatrixConstructNode node)
|
void |
visitMethodCallNode(ASTPtMethodCallNode node)
|
void |
visitPowerNode(ASTPtPowerNode node)
|
void |
visitProductNode(ASTPtProductNode node)
|
void |
visitRecordConstructNode(ASTPtRecordConstructNode node)
|
void |
visitRelationalNode(ASTPtRelationalNode node)
|
void |
visitShiftNode(ASTPtShiftNode node)
|
void |
visitSumNode(ASTPtSumNode node)
|
void |
visitUnaryNode(ASTPtUnaryNode node)
|
| Methods inherited from class ptolemy.data.expr.AbstractParseTreeVisitor |
|---|
_unsupportedVisitException, visitAssignmentNode, visitUnionConstructNode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Variable _dependentVariable
protected java.util.Set _formalParameters
protected java.lang.String _name
protected ParserScope _scope
protected Variable _variableToRename
| Constructor Detail |
|---|
public ParseTreeFreeVariableRenamer()
| Method Detail |
|---|
public void renameVariables(ASTPtRootNode node,
Variable dependentVariable,
Variable variableToRename,
java.lang.String name)
throws IllegalActionException
node - The root node of the parse tree.dependentVariable - The dependent variable.variableToRename - The variable to rename.name - The new name.
IllegalActionException
public void visitArrayConstructNode(ASTPtArrayConstructNode node)
throws IllegalActionException
visitArrayConstructNode in interface ParseTreeVisitorvisitArrayConstructNode in class AbstractParseTreeVisitorIllegalActionException
public void visitBitwiseNode(ASTPtBitwiseNode node)
throws IllegalActionException
visitBitwiseNode in interface ParseTreeVisitorvisitBitwiseNode in class AbstractParseTreeVisitorIllegalActionException
public void visitFunctionApplicationNode(ASTPtFunctionApplicationNode node)
throws IllegalActionException
visitFunctionApplicationNode in interface ParseTreeVisitorvisitFunctionApplicationNode in class AbstractParseTreeVisitorIllegalActionException
public void visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node)
throws IllegalActionException
visitFunctionDefinitionNode in interface ParseTreeVisitorvisitFunctionDefinitionNode in class AbstractParseTreeVisitorIllegalActionException
public void visitFunctionalIfNode(ASTPtFunctionalIfNode node)
throws IllegalActionException
visitFunctionalIfNode in interface ParseTreeVisitorvisitFunctionalIfNode in class AbstractParseTreeVisitorIllegalActionException
public void visitLeafNode(ASTPtLeafNode node)
throws IllegalActionException
visitLeafNode in interface ParseTreeVisitorvisitLeafNode in class AbstractParseTreeVisitorIllegalActionException
public void visitLogicalNode(ASTPtLogicalNode node)
throws IllegalActionException
visitLogicalNode in interface ParseTreeVisitorvisitLogicalNode in class AbstractParseTreeVisitorIllegalActionException
public void visitMatrixConstructNode(ASTPtMatrixConstructNode node)
throws IllegalActionException
visitMatrixConstructNode in interface ParseTreeVisitorvisitMatrixConstructNode in class AbstractParseTreeVisitorIllegalActionException
public void visitMethodCallNode(ASTPtMethodCallNode node)
throws IllegalActionException
visitMethodCallNode in interface ParseTreeVisitorvisitMethodCallNode in class AbstractParseTreeVisitorIllegalActionException
public void visitPowerNode(ASTPtPowerNode node)
throws IllegalActionException
visitPowerNode in interface ParseTreeVisitorvisitPowerNode in class AbstractParseTreeVisitorIllegalActionException
public void visitProductNode(ASTPtProductNode node)
throws IllegalActionException
visitProductNode in interface ParseTreeVisitorvisitProductNode in class AbstractParseTreeVisitorIllegalActionException
public void visitRecordConstructNode(ASTPtRecordConstructNode node)
throws IllegalActionException
visitRecordConstructNode in interface ParseTreeVisitorvisitRecordConstructNode in class AbstractParseTreeVisitorIllegalActionException
public void visitRelationalNode(ASTPtRelationalNode node)
throws IllegalActionException
visitRelationalNode in interface ParseTreeVisitorvisitRelationalNode in class AbstractParseTreeVisitorIllegalActionException
public void visitShiftNode(ASTPtShiftNode node)
throws IllegalActionException
visitShiftNode in interface ParseTreeVisitorvisitShiftNode in class AbstractParseTreeVisitorIllegalActionException
public void visitSumNode(ASTPtSumNode node)
throws IllegalActionException
visitSumNode in interface ParseTreeVisitorvisitSumNode in class AbstractParseTreeVisitorIllegalActionException
public void visitUnaryNode(ASTPtUnaryNode node)
throws IllegalActionException
visitUnaryNode in interface ParseTreeVisitorvisitUnaryNode in class AbstractParseTreeVisitorIllegalActionException
protected java.util.Collection _intersection(java.util.Collection collection1,
java.util.Collection collection2)
collection1 - The first collection.collection2 - The second collection.
protected void _visitAllChildren(ASTPtRootNode node)
throws IllegalActionException
_visitAllChildren in class AbstractParseTreeVisitornode - The node whose children are to be looped through.
IllegalActionException - If thrown while visiting a child
node.
protected void _visitChild(ASTPtRootNode node,
int i)
throws IllegalActionException
_visitChild in class AbstractParseTreeVisitornode - The node.i - The index of the child to be visited.
IllegalActionException - If thrown while visiting a child
node.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||