A node of an expression tree that has exactly 2 children, a left child and a right child. More...
Public Member Functions | |
OpNode (Expression leftChild, Expression rightChild) | |
void | setLeftChild (Expression x) |
void | setRightChild (Expression x) |
Expression | getLeftChild () |
Expression | getRightChild () |
abstract String | getSymbol () |
Returns the text symbol that represents the operation. | |
abstract double | eval (VarMap v, FuncMap f) |
Returns the result of evaluating the expression tree rooted at this node. | |
boolean | isDescendent (Expression x) |
Returns true if this node is a descendent of the specified node, false otherwise. | |
Expression | getParent () |
Returns the parent of this node. | |
String[] | getVariableNames () |
Returns an array of exact length of the variable names contained in the expression tree rooted at this node. | |
String[] | getFunctionNames () |
Returns an array of exact length of the function names contained in the expression tree rooted at this node. | |
String | toString () |
Returns a string that represents the expression tree rooted at this node. | |
Protected Member Functions | |
void | checkBeforeAccept (Expression x) |
Protected method used to verify that the specified expression can be included as a child expression of this node. | |
Protected Attributes | |
Expression | leftChild = null |
Expression | rightChild = null |
Expression | parent = null |
A node of an expression tree that has exactly 2 children, a left child and a right child.
After the children are evaluated, a mathematical operation is applied and the result is returned.
Definition at line 7 of file OpNode.java.
com.graphbuilder.math.OpNode.OpNode | ( | Expression | leftChild, | |
Expression | rightChild | |||
) |
Definition at line 12 of file OpNode.java.
References com.graphbuilder.math.OpNode.setLeftChild(), and com.graphbuilder.math.OpNode.setRightChild().
void com.graphbuilder.math.Expression.checkBeforeAccept | ( | Expression | x | ) | [protected, inherited] |
Protected method used to verify that the specified expression can be included as a child expression of this node.
IllegalArgumentException | If the specified expression is not accepted. |
Definition at line 51 of file Expression.java.
References com.graphbuilder.math.Expression.isDescendent(), and com.graphbuilder.math.Expression.parent.
Referenced by com.graphbuilder.math.FuncNode.insert(), com.graphbuilder.math.OpNode.setLeftChild(), and com.graphbuilder.math.OpNode.setRightChild().
abstract double com.graphbuilder.math.Expression.eval | ( | VarMap | v, | |
FuncMap | f | |||
) | [pure virtual, inherited] |
Returns the result of evaluating the expression tree rooted at this node.
Implemented in com.graphbuilder.math.AddNode, com.graphbuilder.math.DivNode, com.graphbuilder.math.EqualNode, com.graphbuilder.math.FuncNode, com.graphbuilder.math.MultNode, com.graphbuilder.math.PowNode, com.graphbuilder.math.SubNode, com.graphbuilder.math.ValNode, and com.graphbuilder.math.VarNode.
Referenced by edu.rice.cs.hpc.viewer.metric.ExpressionVerification.check(), com.graphbuilder.math.SubNode.eval(), com.graphbuilder.math.PowNode.eval(), com.graphbuilder.math.MultNode.eval(), com.graphbuilder.math.FuncNode.eval(), com.graphbuilder.math.EqualNode.eval(), com.graphbuilder.math.DivNode.eval(), com.graphbuilder.math.AddNode.eval(), edu.rice.cs.hpc.viewer.metric.ExtDerivedMetricDlg.evaluateExpression(), edu.rice.cs.hpc.data.experiment.metric.DerivedMetric.getDoubleValue(), edu.rice.cs.hpc.data.experiment.metric.MetricVarMap.main(), com.graphbuilder.test.MathTest.main(), and edu.rice.cs.hpc.data.experiment.metric.AggregateMetric.setScopeValue().
String [] com.graphbuilder.math.Expression.getFunctionNames | ( | ) | [inherited] |
Returns an array of exact length of the function names contained in the expression tree rooted at this node.
Definition at line 72 of file Expression.java.
References com.graphbuilder.math.Expression.getTermNames().
Expression com.graphbuilder.math.OpNode.getLeftChild | ( | ) |
Definition at line 33 of file OpNode.java.
References com.graphbuilder.math.OpNode.leftChild.
Expression com.graphbuilder.math.Expression.getParent | ( | ) | [inherited] |
Returns the parent of this node.
Definition at line 41 of file Expression.java.
References com.graphbuilder.math.Expression.parent.
Expression com.graphbuilder.math.OpNode.getRightChild | ( | ) |
Definition at line 37 of file OpNode.java.
References com.graphbuilder.math.OpNode.rightChild.
abstract String com.graphbuilder.math.OpNode.getSymbol | ( | ) | [pure virtual] |
Returns the text symbol that represents the operation.
Implemented in com.graphbuilder.math.AddNode, com.graphbuilder.math.DivNode, com.graphbuilder.math.EqualNode, com.graphbuilder.math.MultNode, com.graphbuilder.math.PowNode, and com.graphbuilder.math.SubNode.
Referenced by com.graphbuilder.math.Expression.toString().
String [] com.graphbuilder.math.Expression.getVariableNames | ( | ) | [inherited] |
Returns an array of exact length of the variable names contained in the expression tree rooted at this node.
Definition at line 65 of file Expression.java.
References com.graphbuilder.math.Expression.getTermNames().
boolean com.graphbuilder.math.Expression.isDescendent | ( | Expression | x | ) | [inherited] |
Returns true if this node is a descendent of the specified node, false otherwise.
By this methods definition, a node is a descendent of itself.
Definition at line 26 of file Expression.java.
References com.graphbuilder.math.Expression.parent.
Referenced by com.graphbuilder.math.Expression.checkBeforeAccept().
void com.graphbuilder.math.OpNode.setLeftChild | ( | Expression | x | ) |
Definition at line 17 of file OpNode.java.
References com.graphbuilder.math.Expression.checkBeforeAccept(), com.graphbuilder.math.OpNode.leftChild, and com.graphbuilder.math.Expression.parent.
Referenced by com.graphbuilder.math.OpNode.OpNode().
void com.graphbuilder.math.OpNode.setRightChild | ( | Expression | x | ) |
Definition at line 25 of file OpNode.java.
References com.graphbuilder.math.Expression.checkBeforeAccept(), com.graphbuilder.math.Expression.parent, and com.graphbuilder.math.OpNode.rightChild.
Referenced by com.graphbuilder.math.OpNode.OpNode().
String com.graphbuilder.math.Expression.toString | ( | ) | [inherited] |
Returns a string that represents the expression tree rooted at this node.
Definition at line 114 of file Expression.java.
Referenced by edu.rice.cs.hpc.viewer.metric.ExtDerivedMetricDlg.createDialogArea(), and com.graphbuilder.math.Expression.toString().
Expression com.graphbuilder.math.OpNode.leftChild = null [protected] |
Definition at line 9 of file OpNode.java.
Referenced by com.graphbuilder.math.SubNode.eval(), com.graphbuilder.math.PowNode.eval(), com.graphbuilder.math.MultNode.eval(), com.graphbuilder.math.EqualNode.eval(), com.graphbuilder.math.DivNode.eval(), com.graphbuilder.math.AddNode.eval(), com.graphbuilder.math.OpNode.getLeftChild(), com.graphbuilder.math.Expression.getTermNames(), com.graphbuilder.math.OpNode.setLeftChild(), and com.graphbuilder.math.Expression.toString().
Expression com.graphbuilder.math.Expression.parent = null [protected, inherited] |
Definition at line 15 of file Expression.java.
Referenced by com.graphbuilder.math.Expression.checkBeforeAccept(), com.graphbuilder.math.Expression.getParent(), com.graphbuilder.math.FuncNode.insert(), com.graphbuilder.math.Expression.isDescendent(), com.graphbuilder.math.OpNode.setLeftChild(), and com.graphbuilder.math.OpNode.setRightChild().
Expression com.graphbuilder.math.OpNode.rightChild = null [protected] |
Definition at line 10 of file OpNode.java.
Referenced by com.graphbuilder.math.SubNode.eval(), com.graphbuilder.math.PowNode.eval(), com.graphbuilder.math.MultNode.eval(), com.graphbuilder.math.EqualNode.eval(), com.graphbuilder.math.DivNode.eval(), com.graphbuilder.math.AddNode.eval(), com.graphbuilder.math.OpNode.getRightChild(), com.graphbuilder.math.Expression.getTermNames(), com.graphbuilder.math.OpNode.setRightChild(), and com.graphbuilder.math.Expression.toString().