Expression is the ancestor of all expression classes. More...
Public Member Functions | |
virtual Expression * | clone () const =0 |
Clone this Expression. | |
Expression (const Expression &exprSrc) | |
Create a new expression from an existing expression. | |
virtual bool | isCompositeExpression () const =0 |
Test whether this Expression is an instance of CompositeExpression. | |
virtual bool | isConstantExpression () const =0 |
Test whether this Expression is an instance of ConstantExpression. | |
virtual bool | isNodeExpression () const =0 |
Test whether this Expression is an instance of NodeExpression. | |
Expression & | operator= (const Expression &rightExpr) |
Assignment operator. | |
std::string | toString () |
Return a string representation of this expression. | |
Static Public Member Functions | |
static Expression * | stringToExpression (const std::string &str, const Class &cls) |
Equivalent to stringToExpression (string, Domain) except that it takes a Class as second argument. | |
static Expression * | stringToExpression (const std::string &str, const Domain &dom) |
Create an Expression from a given string. |
Expression is the ancestor of all expression classes.
Expression classes are used to build expressions for discrete chance node tables and utility tables (see also class Model).
HAPI::Expression::Expression | ( | const Expression & | exprSrc | ) |
Create a new expression from an existing expression.
exprSrc | the existing expression |
virtual Expression* HAPI::Expression::clone | ( | ) | const [pure virtual] |
Clone this Expression.
Implemented in HAPI::NodeExpression, HAPI::LabelExpression, HAPI::BooleanExpression, HAPI::NumberExpression, HAPI::NormalDistribution, HAPI::LogNormalDistribution, HAPI::BetaDistribution, HAPI::GammaDistribution, HAPI::ExponentialDistribution, HAPI::WeibullDistribution, HAPI::UniformDistribution, HAPI::TriangularDistribution, HAPI::PERTDistribution, HAPI::BinomialDistribution, HAPI::PoissonDistribution, HAPI::NegativeBinomialDistribution, HAPI::GeometricDistribution, HAPI::DistributionDistribution, HAPI::NoisyOrDistribution, HAPI::TruncateExpression, HAPI::MinExpression, HAPI::MaxExpression, HAPI::LogExpression, HAPI::Log2Expression, HAPI::Log10Expression, HAPI::ExpExpression, HAPI::SinExpression, HAPI::CosExpression, HAPI::TanExpression, HAPI::SinhExpression, HAPI::CoshExpression, HAPI::TanhExpression, HAPI::SqrtExpression, HAPI::AbsExpression, HAPI::FloorExpression, HAPI::CeilExpression, HAPI::ModExpression, HAPI::IfExpression, HAPI::AndExpression, HAPI::OrExpression, HAPI::NotExpression, HAPI::AddExpression, HAPI::SubtractExpression, HAPI::MultiplyExpression, HAPI::DivideExpression, HAPI::PowerExpression, HAPI::NegateExpression, HAPI::EqualsExpression, HAPI::LessThanExpression, HAPI::GreaterThanExpression, HAPI::NotEqualsExpression, HAPI::LessThanOrEqualsExpression, and HAPI::GreaterThanOrEqualsExpression.
static Expression* HAPI::Expression::stringToExpression | ( | const std::string & | str, | |
const Domain & | dom | |||
) | [static] |
Create an Expression from a given string.
To ease the creation of complex expressions, it is possible to specify these as strings, instead of building them with objects.
Example: The following code
Expression *result=new IfExpression (new BooleanExpression (true), new NumberExpression (1), new DistributionDistribution (new NumberExpression (1), new NumberExpression (2)));
can be written like this:
Expression *result = Expression::stringToExpression ("if (true, 1, Distribution (1,2)) ", domain);
str | The string containing a textual representation of the expression | |
dom | The domain in which the Expression is generated |
std::string HAPI::Expression::toString | ( | ) |
Return a string representation of this expression.