The class from which all nodes of an expression tree are descendents. More...
Public Member Functions | |
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 | parent = null |
Private Member Functions | |
String[] | getTermNames (boolean varNames) |
Static Private Member Functions | |
static void | getTermNames (Expression x, Bag b, boolean varNames) |
static void | toString (Expression x, StringBuffer sb) |
The class from which all nodes of an expression tree are descendents.
Expressions can be evaluated using the eval method. Expressions that are or have FuncNodes or VarNodes as descendents must provide a VarMap or FuncMap respectively. Expressions that consist entirely of OpNodes and ValNodes do not require a VarMap or FuncMap. For Expressions that support children (OpNodes, FuncNodes), a child can only be accepted provided it currently has no parent, a cyclic reference is not formed, and it is non-null.
Definition at line 13 of file Expression.java.
void com.graphbuilder.math.Expression.checkBeforeAccept | ( | Expression | x | ) | [protected] |
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().
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 | ( | ) |
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.Expression.getParent | ( | ) |
Returns the parent of this node.
Definition at line 41 of file Expression.java.
References com.graphbuilder.math.Expression.parent.
static void com.graphbuilder.math.Expression.getTermNames | ( | Expression | x, | |
Bag | b, | |||
boolean | varNames | |||
) | [static, private] |
Definition at line 85 of file Expression.java.
References com.graphbuilder.struc.Bag.add(), com.graphbuilder.math.FuncNode.child(), com.graphbuilder.struc.Bag.contains(), com.graphbuilder.math.Expression.getTermNames(), com.graphbuilder.math.OpNode.leftChild, com.graphbuilder.math.TermNode.name, com.graphbuilder.math.FuncNode.numChildren(), and com.graphbuilder.math.OpNode.rightChild.
String [] com.graphbuilder.math.Expression.getTermNames | ( | boolean | varNames | ) | [private] |
Definition at line 76 of file Expression.java.
References com.graphbuilder.struc.Bag.get(), and com.graphbuilder.struc.Bag.size.
Referenced by com.graphbuilder.math.Expression.getFunctionNames(), com.graphbuilder.math.Expression.getTermNames(), and com.graphbuilder.math.Expression.getVariableNames().
String [] com.graphbuilder.math.Expression.getVariableNames | ( | ) |
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 | ) |
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().
static void com.graphbuilder.math.Expression.toString | ( | Expression | x, | |
StringBuffer | sb | |||
) | [static, private] |
Definition at line 120 of file Expression.java.
References com.graphbuilder.math.FuncNode.child(), com.graphbuilder.math.TermNode.getName(), com.graphbuilder.math.TermNode.getNegate(), com.graphbuilder.math.OpNode.getSymbol(), com.graphbuilder.math.OpNode.leftChild, com.graphbuilder.math.FuncNode.numChildren(), com.graphbuilder.math.OpNode.rightChild, and com.graphbuilder.math.Expression.toString().
String com.graphbuilder.math.Expression.toString | ( | ) |
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.Expression.parent = null [protected] |
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().