com.graphbuilder.math.Expression Class Reference

The class from which all nodes of an expression tree are descendents. More...

Inheritance diagram for com.graphbuilder.math.Expression:
Inheritance graph
[legend]
Collaboration diagram for com.graphbuilder.math.Expression:
Collaboration graph
[legend]

List of all members.

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)

Detailed Description

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.


Member Function Documentation

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.

Exceptions:
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]
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]
String [] com.graphbuilder.math.Expression.getTermNames ( boolean  varNames  )  [private]
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]
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().


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1