9template<
typename RationalNumberType>
14template<
typename RationalNumberType>
20template<
typename RationalNumberType>
22 return boost::any_cast<RationalNumberType>(expression.
accept(*
this, boost::none));
25template<
typename RationalNumberType>
29 conditionValue = evaluator->asBool(expression.
getCondition());
32 conditionValue = expression.
getCondition()->evaluateAsBool();
41template<
typename RationalNumberType>
43 STORM_LOG_THROW(
false, storm::exceptions::InvalidArgumentException,
"Expression cannot be translated into a rational number.");
46template<
typename RationalNumberType>
48 RationalNumberType firstOperandAsRationalNumber = boost::any_cast<RationalNumberType>(expression.
getFirstOperand()->accept(*
this, data));
49 RationalNumberType secondOperandAsRationalNumber = boost::any_cast<RationalNumberType>(expression.
getSecondOperand()->accept(*
this, data));
50 RationalNumberType result;
53 result = firstOperandAsRationalNumber + secondOperandAsRationalNumber;
56 result = firstOperandAsRationalNumber - secondOperandAsRationalNumber;
59 result = firstOperandAsRationalNumber * secondOperandAsRationalNumber;
62 result = firstOperandAsRationalNumber / secondOperandAsRationalNumber;
65 result = std::min(firstOperandAsRationalNumber, secondOperandAsRationalNumber);
68 result = std::max(firstOperandAsRationalNumber, secondOperandAsRationalNumber);
72 "Exponent of power operator must be an integer.");
73 auto exponentAsInteger = storm::utility::convertNumber<int_fast64_t>(secondOperandAsRationalNumber);
86template<
typename RationalNumberType>
88 STORM_LOG_THROW(
false, storm::exceptions::InvalidArgumentException,
"Expression cannot be translated into a rational number.");
91template<
typename RationalNumberType>
96template<
typename RationalNumberType>
98 STORM_LOG_THROW(
false, storm::exceptions::InvalidArgumentException,
"Expression cannot be translated into a rational number.");
101template<
typename RationalNumberType>
103 RationalNumberType operandAsRationalNumber = boost::any_cast<RationalNumberType>(expression.
getOperand()->accept(*
this, data));
104 RationalNumberType result;
107 result = -operandAsRationalNumber;
123template<
typename RationalNumberType>
125 STORM_LOG_THROW(
false, storm::exceptions::InvalidArgumentException,
"Expression cannot be translated into a rational number.");
128template<
typename RationalNumberType>
130 return RationalNumberType(carl::rationalize<storm::RationalNumber>(
static_cast<carl::sint
>(expression.
getValue())));
133template<
typename RationalNumberType>
138template<
typename RationalNumberType>
140 valueMapping[variable] = value;
std::shared_ptr< BaseExpression const > const & getSecondOperand() const
Retrieves the second operand of the expression.
std::shared_ptr< BaseExpression const > const & getFirstOperand() const
Retrieves the first operand of the expression.
OperatorType getOperatorType() const
Retrieves the operator associated with the expression.
boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const
Accepts the given visitor.
std::shared_ptr< BaseExpression const > getElseExpression() const
Retrieves the else expression of the if-then-else expression.
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.
int_fast64_t getValue() const
Retrieves the value of the integer literal.
storm::RationalNumber getValue() const
Retrieves the value of the double literal.
RationalNumberType toRationalNumber(Expression const &expression)
ToRationalNumberVisitor()
void setMapping(storm::expressions::Variable const &variable, RationalNumberType const &value)
virtual boost::any visit(IfThenElseExpression const &expression, boost::any const &data) override
virtual std::shared_ptr< BaseExpression const > getOperand(uint_fast64_t operandIndex) const override
Retrieves the given operand from the expression.
OperatorType getOperatorType() const
Retrieves the operator associated with this expression.
Variable const & getVariable() const
Retrieves the variable associated with this expression.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
ValueType floor(ValueType const &number)
ValueType ceil(ValueType const &number)
bool isInteger(ValueType const &number)
ValueType pow(ValueType const &value, int_fast64_t exponent)