1 #ifndef MATH_RootExpression_H
2 #define MATH_RootExpression_H
31 SP::MATH_Variable mValue;
56 static inline SP::MATH_RootExpression
New() {
64 inline const double&
operator[](
const int& index)
const {
65 return (*mValue.get())[index];
78 return &(*mValue.get())[0];
82 inline const double&
getValue(
const int& index)
const {
83 return (*mValue.get())[index];
113 virtual double evaluate(SP::MATH_Environment env) {
126 evaluate(action,symbols,*mValue.get());
127 return (*mValue.get())[0];
132 if (symbols.get()!=
null)
return evaluate(action,*symbols.get());
157 return parse(expr,*env.get());
182 void replaceEPowerByTenPower(
tString& expr)
const;
185 void deleteBlanks(
tString& expr)
const;
virtual double evaluate(MATH_Environment &env)
void evaluate the expression
Definition: MATH_RootExpression.h:108
virtual double evaluate(const tFlag &action, SP::MATH_Environment symbols)
void evaluate the expression
Definition: MATH_RootExpression.h:131
This class decribes a variable class for evaluation.
Definition: MATH_Variable.h:16
tBoolean parse(const tString &expr, MATH_Environment &symbols)
parse the string
Definition: MATH_RootExpression.cpp:65
static SP::MATH_RootExpression New()
create a root expression
Definition: MATH_RootExpression.h:56
tBoolean parse(const tString &expr)
parse the string
Definition: MATH_RootExpression.h:155
This class is a node of expression tree with is a parent and a child.
Definition: MATH_NodeExpression.h:18
virtual int evaluate(const tFlag &action, MATH_Environment &symbols, MATH_Variable &var) const
void evaluate the expression
Definition: MATH_ParentExpression.h:163
virtual SP::MATH_ExpressionClassFactory newClassFactoryInstance() const
create a class factory for leaves or operators
Definition: MATH_RootExpression.cpp:15
#define tBoolean
Definition: types.h:35
this class describes a class factory to generate MATH_Expression classes. The nodes lists are initial...
Definition: MATH_ExpressionClassFactory.h:22
virtual double evaluate()
void evaluate the expression
Definition: MATH_RootExpression.h:102
virtual double evaluate(SP::MATH_Environment env)
void evaluate the expression
Definition: MATH_RootExpression.h:113
#define null
Definition: types.h:13
DEFINE_SVPTR(MATH_RootExpression)
This class is a root expression The MATH_RootExpression::newClassFactoryInstance() creates the class ...
Definition: MATH_RootExpression.h:24
const double * getValues() const
get the values
Definition: MATH_RootExpression.h:77
DEFINE_SPTR(MATH_ExpressionClassFactory)
virtual int evaluate(const tFlag &action, MATH_Environment &symbols, MATH_Variable &var) const
void evaluate the expression
Definition: MATH_RootExpression.h:97
virtual double evaluate(const tFlag &action)
void evaluate the expression
Definition: MATH_RootExpression.h:119
const double & operator[](const int &index) const
Definition: MATH_RootExpression.h:64
This class describes a parent of math expression tree. A parent have arguments:
Definition: MATH_ParentExpression.h:22
static SP::MATH_Environment New()
create a node expression
Definition: MATH_Environment.h:50
virtual tString toString() const
return the string representation
Definition: MATH_RootExpression.cpp:120
#define tString
Definition: types.h:36
virtual const MATH_RootExpression * getRootNode() const
return the root node of the node
Definition: MATH_RootExpression.h:90
This class decribes an environment class.
Definition: MATH_Environment.h:14
virtual double evaluate(const tFlag &action, MATH_Environment &symbols)
void evaluate the expression
Definition: MATH_RootExpression.h:125
MATH_RootExpression(void)
create
Definition: MATH_RootExpression.cpp:7
const double & getValue(const int &index) const
get the values
Definition: MATH_RootExpression.h:82
virtual ~MATH_RootExpression(void)
destroy
Definition: MATH_RootExpression.cpp:11
static const tFlag ALGEBRIC
Definition: MATH_Expression.h:31
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14