Storm
A Modern Probabilistic Model Checker
|
#include <IfThenElseExpression.h>
Public Member Functions | |
IfThenElseExpression (ExpressionManager const &manager, Type const &type, std::shared_ptr< BaseExpression const > const &condition, std::shared_ptr< BaseExpression const > const &thenExpression, std::shared_ptr< BaseExpression const > const &elseExpression) | |
Creates an if-then-else expression with the given return type, condition and operands. | |
IfThenElseExpression (IfThenElseExpression const &other)=default | |
IfThenElseExpression & | operator= (IfThenElseExpression const &other)=delete |
IfThenElseExpression (IfThenElseExpression &&)=default | |
IfThenElseExpression & | operator= (IfThenElseExpression &&)=delete |
virtual | ~IfThenElseExpression ()=default |
virtual std::shared_ptr< BaseExpression const > | getOperand (uint_fast64_t operandIndex) const override |
Retrieves the given operand from the expression. | |
virtual OperatorType | getOperator () const override |
Retrieves the operator of a function application. | |
virtual bool | isFunctionApplication () const override |
Checks if the expression is a function application (of any sort). | |
virtual bool | containsVariables () const override |
Retrieves whether the expression contains a variable. | |
virtual uint_fast64_t | getArity () const override |
Returns the arity of the expression. | |
virtual bool | evaluateAsBool (Valuation const *valuation=nullptr) const override |
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting boolean value. | |
virtual int_fast64_t | evaluateAsInt (Valuation const *valuation=nullptr) const override |
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting integer value. | |
virtual double | evaluateAsDouble (Valuation const *valuation=nullptr) const override |
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting double value. | |
virtual void | gatherVariables (std::set< storm::expressions::Variable > &variables) const override |
Retrieves the set of all variables that appear in the expression. | |
virtual std::shared_ptr< BaseExpression const > | simplify () const override |
Simplifies the expression according to some simple rules. | |
virtual boost::any | accept (ExpressionVisitor &visitor, boost::any const &data) const override |
Accepts the given visitor by calling its visit method. | |
virtual bool | isIfThenElseExpression () const override |
std::shared_ptr< BaseExpression const > | getCondition () const |
Retrieves the condition expression of the if-then-else expression. | |
std::shared_ptr< BaseExpression const > | getThenExpression () const |
Retrieves the then expression of the if-then-else expression. | |
std::shared_ptr< BaseExpression const > | getElseExpression () const |
Retrieves the else expression of the if-then-else expression. | |
![]() | |
BaseExpression (ExpressionManager const &manager, Type const &type) | |
Constructs a base expression with the given return type. | |
BaseExpression (BaseExpression const &)=default | |
BaseExpression & | operator= (BaseExpression const &)=delete |
BaseExpression (BaseExpression &&)=default | |
BaseExpression & | operator= (BaseExpression &&)=delete |
virtual | ~BaseExpression ()=default |
Expression | toExpression () const |
Converts the base expression to a proper expression. | |
virtual storm::RationalNumber | evaluateAsRational () const |
Evaluates the expression and returns the resulting rational number. | |
virtual std::string const & | getIdentifier () const |
Retrieves the identifier associated with this expression. | |
virtual bool | isLiteral () const |
Retrieves whether the expression is a literal. | |
virtual bool | isVariable () const |
Retrieves whether the expression is a variable. | |
virtual bool | isTrue () const |
Checks if the expression is equal to the boolean literal true. | |
virtual bool | isFalse () const |
Checks if the expression is equal to the boolean literal false. | |
std::shared_ptr< BaseExpression const > | reduceNesting () const |
Tries to flatten the syntax tree of the expression, e.g., 1 + (2 + (3 + 4)) becomes (1 + 2) + (3 + 4) | |
bool | hasNumericalType () const |
Retrieves whether the expression has a numerical type, i.e., integer or double. | |
bool | hasIntegerType () const |
Retrieves whether the expression has an integer type. | |
bool | hasBitVectorType () const |
Retrieves whether the expression has a bitvector type. | |
bool | hasBooleanType () const |
Retrieves whether the expression has a boolean type. | |
bool | hasRationalType () const |
Retrieves whether the expression has a rational return type. | |
std::shared_ptr< BaseExpression const > | getSharedPointer () const |
Retrieves a shared pointer to this expression. | |
ExpressionManager const & | getManager () const |
Retrieves the manager responsible for this expression. | |
Type const & | getType () const |
Retrieves the type of the expression. | |
IfThenElseExpression const & | asIfThenElseExpression () const |
virtual bool | isBinaryBooleanFunctionExpression () const |
BinaryBooleanFunctionExpression const & | asBinaryBooleanFunctionExpression () const |
virtual bool | isBinaryNumericalFunctionExpression () const |
BinaryNumericalFunctionExpression const & | asBinaryNumericalFunctionExpression () const |
virtual bool | isBinaryRelationExpression () const |
BinaryRelationExpression const & | asBinaryRelationExpression () const |
virtual bool | isBooleanLiteralExpression () const |
BooleanLiteralExpression const & | asBooleanLiteralExpression () const |
virtual bool | isIntegerLiteralExpression () const |
IntegerLiteralExpression const & | asIntegerLiteralExpression () const |
virtual bool | isRationalLiteralExpression () const |
RationalLiteralExpression const & | asRationalLiteralExpression () const |
virtual bool | isUnaryBooleanFunctionExpression () const |
UnaryBooleanFunctionExpression const & | asUnaryBooleanFunctionExpression () const |
virtual bool | isUnaryNumericalFunctionExpression () const |
UnaryNumericalFunctionExpression const & | asUnaryNumericalFunctionExpression () const |
virtual bool | isVariableExpression () const |
VariableExpression const & | asVariableExpression () const |
virtual bool | isPredicateExpression () const |
PredicateExpression const & | asPredicateExpression () const |
Protected Member Functions | |
virtual void | printToStream (std::ostream &stream) const override |
Prints the expression to the given stream. | |
Definition at line 9 of file IfThenElseExpression.h.
storm::expressions::IfThenElseExpression::IfThenElseExpression | ( | ExpressionManager const & | manager, |
Type const & | type, | ||
std::shared_ptr< BaseExpression const > const & | condition, | ||
std::shared_ptr< BaseExpression const > const & | thenExpression, | ||
std::shared_ptr< BaseExpression const > const & | elseExpression | ||
) |
Creates an if-then-else expression with the given return type, condition and operands.
manager | The manager responsible for this expression. |
type | The return type of the expression. |
thenExpression | The expression evaluated if the condition evaluates true. |
elseExpression | The expression evaluated if the condition evaluates false. |
Definition at line 10 of file IfThenElseExpression.cpp.
|
default |
|
default |
|
virtualdefault |
|
overridevirtual |
Accepts the given visitor by calling its visit method.
visitor | The visitor that is to be accepted. |
Implements storm::expressions::BaseExpression.
Definition at line 97 of file IfThenElseExpression.cpp.
|
overridevirtual |
Retrieves whether the expression contains a variable.
Reimplemented from storm::expressions::BaseExpression.
Definition at line 36 of file IfThenElseExpression.cpp.
|
overridevirtual |
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting boolean value.
If the return type of the expression is not a boolean an exception is thrown.
valuation | The valuation of unknowns under which to evaluate the expression. |
Reimplemented from storm::expressions::BaseExpression.
Definition at line 44 of file IfThenElseExpression.cpp.
|
overridevirtual |
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting double value.
If the return type of the expression is not a double an exception is thrown.
valuation | The valuation of unknowns under which to evaluate the expression. |
Reimplemented from storm::expressions::BaseExpression.
Definition at line 62 of file IfThenElseExpression.cpp.
|
overridevirtual |
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valuation and returns the resulting integer value.
If the return type of the expression is not an integer an exception is thrown.
valuation | The valuation of unknowns under which to evaluate the expression. |
Reimplemented from storm::expressions::BaseExpression.
Definition at line 53 of file IfThenElseExpression.cpp.
|
overridevirtual |
Retrieves the set of all variables that appear in the expression.
The | set into which all variables in this expresson are inserted. |
Implements storm::expressions::BaseExpression.
Definition at line 71 of file IfThenElseExpression.cpp.
|
overridevirtual |
Returns the arity of the expression.
Reimplemented from storm::expressions::BaseExpression.
Definition at line 40 of file IfThenElseExpression.cpp.
std::shared_ptr< BaseExpression const > storm::expressions::IfThenElseExpression::getCondition | ( | ) | const |
Retrieves the condition expression of the if-then-else expression.
Definition at line 105 of file IfThenElseExpression.cpp.
std::shared_ptr< BaseExpression const > storm::expressions::IfThenElseExpression::getElseExpression | ( | ) | const |
Retrieves the else expression of the if-then-else expression.
Definition at line 113 of file IfThenElseExpression.cpp.
|
overridevirtual |
Retrieves the given operand from the expression.
operandIndex | The index of the operand to retrieve. This must be lower than the arity of the expression. |
Reimplemented from storm::expressions::BaseExpression.
Definition at line 17 of file IfThenElseExpression.cpp.
|
overridevirtual |
Retrieves the operator of a function application.
This is only legal to call if the expression is function application.
Reimplemented from storm::expressions::BaseExpression.
Definition at line 28 of file IfThenElseExpression.cpp.
std::shared_ptr< BaseExpression const > storm::expressions::IfThenElseExpression::getThenExpression | ( | ) | const |
Retrieves the then expression of the if-then-else expression.
Definition at line 109 of file IfThenElseExpression.cpp.
|
overridevirtual |
Checks if the expression is a function application (of any sort).
Reimplemented from storm::expressions::BaseExpression.
Definition at line 32 of file IfThenElseExpression.cpp.
|
overridevirtual |
Reimplemented from storm::expressions::BaseExpression.
Definition at line 101 of file IfThenElseExpression.cpp.
|
delete |
|
delete |
|
overrideprotectedvirtual |
Prints the expression to the given stream.
stream | The stream to which to write the expression. |
Implements storm::expressions::BaseExpression.
Definition at line 117 of file IfThenElseExpression.cpp.
|
overridevirtual |
Simplifies the expression according to some simple rules.
Implements storm::expressions::BaseExpression.
Definition at line 77 of file IfThenElseExpression.cpp.