Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
IfThenElseExpression.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_EXPRESSIONS_IFTHENELSEEXPRESSION_H_
2#define STORM_STORAGE_EXPRESSIONS_IFTHENELSEEXPRESSION_H_
3
6
7namespace storm {
8namespace expressions {
10 public:
19 IfThenElseExpression(ExpressionManager const& manager, Type const& type, std::shared_ptr<BaseExpression const> const& condition,
20 std::shared_ptr<BaseExpression const> const& thenExpression, std::shared_ptr<BaseExpression const> const& elseExpression);
21
22 // Instantiate constructors and assignments with their default implementations.
27
28 virtual ~IfThenElseExpression() = default;
29
30 // Override base class methods.
31 virtual std::shared_ptr<BaseExpression const> getOperand(uint_fast64_t operandIndex) const override;
32 virtual OperatorType getOperator() const override;
33 virtual bool isFunctionApplication() const override;
34 virtual bool containsVariables() const override;
35 virtual uint_fast64_t getArity() const override;
36 virtual bool evaluateAsBool(Valuation const* valuation = nullptr) const override;
37 virtual int_fast64_t evaluateAsInt(Valuation const* valuation = nullptr) const override;
38 virtual double evaluateAsDouble(Valuation const* valuation = nullptr) const override;
39 virtual void gatherVariables(std::set<storm::expressions::Variable>& variables) const override;
40 virtual std::shared_ptr<BaseExpression const> simplify() const override;
41 virtual boost::any accept(ExpressionVisitor& visitor, boost::any const& data) const override;
42 virtual bool isIfThenElseExpression() const override;
43
49 std::shared_ptr<BaseExpression const> getCondition() const;
50
56 std::shared_ptr<BaseExpression const> getThenExpression() const;
57
63 std::shared_ptr<BaseExpression const> getElseExpression() const;
64
65 protected:
66 // Override base class method.
67 virtual void printToStream(std::ostream& stream) const override;
68
69 private:
70 // The condition of the if-then-else.
71 std::shared_ptr<BaseExpression const> condition;
72
73 // The return expression of the if-part.
74 std::shared_ptr<BaseExpression const> thenExpression;
75
76 // The return expression of the else-part.
77 std::shared_ptr<BaseExpression const> elseExpression;
78};
79} // namespace expressions
80} // namespace storm
81
82#endif /* STORM_STORAGE_EXPRESSIONS_IFTHENELSEEXPRESSION_H_ */
The base class of all expression classes.
This class is responsible for managing a set of typed variables and all expressions using these varia...
virtual std::shared_ptr< BaseExpression const > getOperand(uint_fast64_t operandIndex) const override
Retrieves the given operand from the expression.
std::shared_ptr< BaseExpression const > getElseExpression() const
Retrieves the else expression of the if-then-else expression.
virtual bool isIfThenElseExpression() const override
IfThenElseExpression & operator=(IfThenElseExpression &&)=delete
virtual bool evaluateAsBool(Valuation const *valuation=nullptr) const override
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
virtual uint_fast64_t getArity() const override
Returns the arity of the expression.
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 valua...
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.
std::shared_ptr< BaseExpression const > getCondition() const
Retrieves the condition expression of the if-then-else expression.
virtual OperatorType getOperator() const override
Retrieves the operator of a function application.
virtual double evaluateAsDouble(Valuation const *valuation=nullptr) const override
Evaluates the expression under the valuation of unknowns (variables and constants) given by the valua...
IfThenElseExpression(IfThenElseExpression const &other)=default
virtual std::shared_ptr< BaseExpression const > simplify() const override
Simplifies the expression according to some simple rules.
virtual void printToStream(std::ostream &stream) const override
Prints the expression to the given stream.
virtual boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const override
Accepts the given visitor by calling its visit method.
IfThenElseExpression(IfThenElseExpression &&)=default
virtual void gatherVariables(std::set< storm::expressions::Variable > &variables) const override
Retrieves the set of all variables that appear in the expression.
IfThenElseExpression & operator=(IfThenElseExpression const &other)=delete
std::shared_ptr< BaseExpression const > getThenExpression() const
Retrieves the then expression of the if-then-else expression.
The base class of all valuations of variables.
Definition Valuation.h:16
LabParser.cpp.
Definition cli.cpp:18