@root classes

class Expression

^ 
An Expression represents a mathmatical expression as a tree.

In this format, the internal nodes represent mathematical functions and the leaves represent constant values.

Modified by John Costello for Arithmetica project Last modified on 9/16/02

Source:
exptree.h:22
Author:
rcd@cs.duke.edu
Version:
unknown
Friends:
function Expressionoperator+ undocumented
function Expressionoperator- undocumented
function Expressionoperator* undocumented
function Expressionoperator/ undocumented
function Expressionoperator% undocumented

Contents

^ 
EntityTypeScopeShort Description
~Expressiondestructor public clean up an expression
Expressionconstructor public make an empty expression
Expressionconstructor public make an expression from a value
Expressionconstructor public make a copy of another expression
Expressionconstructor public make an expression from a tree of nodes
comparemethod public compare two expressions by the value they evaluate to
evaluatemethod public evaluate the expression
getRootmethod public return a pointer to myRoot
operator %=operator publicundocumented
operator *operator public evaluate a expression (as if it were a pointer)
operator *=operator publicundocumented
operator +=operator public allow an expression to be combined with another "naturally"
operator -=operator publicundocumented
operator /=operator publicundocumented
operator =operator public allow a value to be assigned to an expression
operator =operator public allow one expression to be assigned to another
printmethod public print the expression as an infix expression
setRootmethod public set myRoot equal to a given pointer

destructor ~Expression

? ^  > 
clean up an expression
Source:
exptree.h:47
Code:
public ~ Expression ( )

constructor Expression

? ^  < > 
make an empty expression
Source:
exptree.h:27
Code:
public Expression ( )

constructor Expression

? ^  < > 
make an expression from a value
Source:
exptree.h:32
Code:
public Expression ( int value )

constructor Expression

? ^  < > 
make a copy of another expression
Source:
exptree.h:37
Code:
public Expression ( const Expression & other )

constructor Expression

? ^  < > 
make an expression from a tree of nodes
Source:
exptree.h:42
Code:
public Expression ( Node * root )

method compare

? ^  < > 
compare two expressions by the value they evaluate to
Source:
exptree.h:79
Returns:
0 if evaluates to equal, negative if less, positive if greater
Code:
public float compare ( const Expression & e ) const

method evaluate

? ^  < > 
evaluate the expression
Source:
exptree.h:86
Returns:
integer value of expression
Code:
public dataType evaluate ( ) const

method getRoot

? ^  < > 
return a pointer to myRoot
Source:
exptree.h:96
Code:
public Node * getRoot ( ) const

operator %=

? ^  < > 
undocumented
Source:
exptree.h:68
Code:
public Expression & operator %= ( const Expression & e )

operator *

? ^  < > 
evaluate a expression (as if it were a pointer)
Source:
exptree.h:73
Code:
public int operator * ( )

operator *=

? ^  < > 
undocumented
Source:
exptree.h:66
Code:
public Expression & operator *= ( const Expression & e )

operator +=

? ^  < > 
allow an expression to be combined with another "naturally"
Source:
exptree.h:64
Code:
public Expression & operator += ( const Expression & e )

operator -=

? ^  < > 
undocumented
Source:
exptree.h:65
Code:
public Expression & operator -= ( const Expression & e )

operator /=

? ^  < > 
undocumented
Source:
exptree.h:67
Code:
public Expression & operator /= ( const Expression & e )

operator =

? ^  < > 
allow a value to be assigned to an expression
Source:
exptree.h:58
Code:
public Expression & operator = ( int value )

operator =

? ^  < > 
allow one expression to be assigned to another
Source:
exptree.h:53
Code:
public Expression & operator = ( const Expression & other )

method print

? ^  < > 
print the expression as an infix expression
Source:
exptree.h:91
Code:
public void print ( ostream & out ) const

method setRoot

? ^  < > 
set myRoot equal to a given pointer
Source:
exptree.h:101
Code:
public void setRoot ( Node * node )

Created Sun Oct 6 20:56:57 2002.
This documentation was generated automatically by
ccdoc v0.8 r26 2001/11/28 bin_opt_suncc_solaris-2.8.
Click here to submit a bug report or feature request.
Click here to return to the top of the page.