com.graphbuilder.math.TermNode Class Reference

A node of an expression tree that represents a variable or a function. More...

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

List of all members.

Public Member Functions

 TermNode (String name, boolean negate)
boolean getNegate ()
 Returns true if the term should negate the result before returning it in the eval method.
void setNegate (boolean b)
String getName ()
 Returns the name of the term.
void setName (String s)
 Sets the name of the term.
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

String name = null
boolean negate = false
Expression parent = null

Static Private Member Functions

static boolean isValidName (String s)

Detailed Description

A node of an expression tree that represents a variable or a function.

Definition at line 6 of file TermNode.java.


Constructor & Destructor Documentation

com.graphbuilder.math.TermNode.TermNode ( String  name,
boolean  negate 
)

Member Function Documentation

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.

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, inherited]
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().

String com.graphbuilder.math.TermNode.getName (  ) 

Returns the name of the term.

Definition at line 30 of file TermNode.java.

References com.graphbuilder.math.TermNode.name.

Referenced by com.graphbuilder.math.Expression.toString().

boolean com.graphbuilder.math.TermNode.getNegate (  ) 

Returns true if the term should negate the result before returning it in the eval method.

Definition at line 19 of file TermNode.java.

References com.graphbuilder.math.TermNode.negate.

Referenced by com.graphbuilder.math.Expression.toString().

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.

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().

static boolean com.graphbuilder.math.TermNode.isValidName ( String  s  )  [static, private]

Definition at line 50 of file TermNode.java.

Referenced by com.graphbuilder.math.TermNode.setName().

void com.graphbuilder.math.TermNode.setName ( String  s  ) 

Sets the name of the term.

Valid names must not begin with a digit or a decimal, and must not contain round brackets, operators, commas or whitespace.

Exceptions:
IllegalArgumentException If the name is null or invalid.

Definition at line 40 of file TermNode.java.

References com.graphbuilder.math.TermNode.isValidName(), and com.graphbuilder.math.TermNode.name.

Referenced by com.graphbuilder.math.TermNode.TermNode().

void com.graphbuilder.math.TermNode.setNegate ( boolean  b  ) 
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().


Member Data Documentation

String com.graphbuilder.math.TermNode.name = null [protected]
boolean com.graphbuilder.math.TermNode.negate = false [protected]
Expression com.graphbuilder.math.Expression.parent = null [protected, inherited]

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

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1