20 if (deleteIdentifierMapping) {
21 delete this->identifiers;
27 if (this->createExpressions) {
30 }
catch (storm::exceptions::InvalidTypeException
const& e) {
40 if (this->createExpressions) {
42 switch (operatorType) {
53 }
catch (storm::exceptions::InvalidTypeException
const& e) {
63 if (this->createExpressions) {
66 switch (operatorType) {
74 }
catch (storm::exceptions::InvalidTypeException
const& e) {
85 if (this->createExpressions) {
87 switch (operatorType) {
104 }
catch (storm::exceptions::InvalidTypeException
const& e) {
114 if (this->createExpressions) {
116 switch (operatorType) {
127 }
catch (storm::exceptions::InvalidTypeException
const& e) {
137 if (this->createExpressions) {
139 switch (operatorType) {
150 }
catch (storm::exceptions::InvalidTypeException
const& e) {
160 if (this->createExpressions) {
162 switch (operatorType) {
173 }
catch (storm::exceptions::InvalidTypeException
const& e) {
183 if (this->createExpressions) {
185 switch (operatorType) {
199 }
catch (storm::exceptions::InvalidTypeException
const& e) {
208 if (this->createExpressions) {
211 for (
auto const& op : operatorTypes) {
225 }
catch (storm::exceptions::InvalidTypeException
const& e) {
234 if (!this->acceptDoubleLiterals) {
238 if (this->createExpressions) {
247 auto const min = storm::utility::convertNumber<storm::RationalNumber>(std::numeric_limits<int64_t>::min());
248 auto const max = storm::utility::convertNumber<storm::RationalNumber>(std::numeric_limits<int64_t>::max());
249 overflow = value < min || value > max;
252 << value <<
"' as a 64 bit integer. Consider appending '.0' to the number to parse it as an (arbitrary precision) float.");
255 }
else if (this->createExpressions) {
256 return manager.
integer(storm::utility::convertNumber<int64_t>(value));
263 if (this->createExpressions) {
273 if (this->createExpressions) {
275 switch (operatorType) {
286 }
catch (storm::exceptions::InvalidTypeException
const& e) {
295 if (this->createExpressions) {
297 switch (operatorType) {
308 }
catch (storm::exceptions::InvalidTypeException
const& e) {
316 if (this->createExpressions) {
319 }
catch (storm::exceptions::InvalidTypeException
const& e) {
327 std::vector<storm::expressions::Expression>
const& operands,
bool& pass)
const {
328 if (this->createExpressions) {
338 STORM_LOG_THROW(
false, storm::exceptions::InvalidTypeException,
"Operator type " << opTyp <<
" invalid for predicate expression.");
340 }
catch (storm::exceptions::InvalidTypeException
const& e) {
348 if (this->createExpressions) {
349 STORM_LOG_THROW(this->identifiers !=
nullptr, storm::exceptions::WrongFormatException,
350 "Unable to substitute identifier expressions without given mapping.");
352 if (expression ==
nullptr) {
363 if (identifiers_ !=
nullptr) {
364 createExpressions =
true;
365 identifiers = identifiers_;
367 createExpressions =
false;
368 identifiers =
nullptr;
375 createExpressions =
true;
376 identifiers =
new qi::symbols<char, storm::expressions::Expression>();
377 for (
auto const& identifierExpressionPair : identifierMapping) {
378 identifiers->add(identifierExpressionPair.first, identifierExpressionPair.second);
380 deleteIdentifierMapping =
true;
384 createExpressions =
false;
385 if (deleteIdentifierMapping) {
386 delete this->identifiers;
387 deleteIdentifierMapping =
false;
389 this->identifiers =
nullptr;
bool hasBooleanType() const
Retrieves whether the expression has a boolean return type.
This class is responsible for managing a set of typed variables and all expressions using these varia...
Expression integer(int_fast64_t value) const
Creates an expression that characterizes the given integer literal.
Expression rational(double value) const
Creates an expression that characterizes the given rational literal.
Expression boolean(bool value) const
Creates an expression that characterizes the given boolean literal.
storm::expressions::Expression createIntegerLiteralExpression(storm::RationalNumber const &value, bool &pass, bool &overflow) const
storm::expressions::Expression getIdentifierExpression(std::string const &identifier, bool &pass) const
storm::expressions::Expression createRationalLiteralExpression(storm::RationalNumber const &value, bool &pass) const
storm::expressions::Expression createPredicateExpression(storm::expressions::OperatorType const &opTyp, std::vector< storm::expressions::Expression > const &operands, bool &pass) const
storm::expressions::Expression createIteExpression(storm::expressions::Expression const &e1, storm::expressions::Expression const &e2, storm::expressions::Expression const &e3, bool &pass) const
ExpressionCreator(storm::expressions::ExpressionManager const &manager)
void setIdentifierMapping(qi::symbols< char, storm::expressions::Expression > const *identifiers_)
Sets an identifier mapping that is used to determine valid variables in the expression.
storm::expressions::Expression createMultExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createPlusExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createEqualsExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createFloorCeilExpression(storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e1, bool &pass) const
void unsetIdentifierMapping()
Unsets a previously set identifier mapping.
storm::expressions::Expression createOrExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createRelationalExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createRoundExpression(storm::expressions::Expression const &e1, bool &pass) const
storm::expressions::Expression createBooleanLiteralExpression(bool value, bool &pass) const
storm::expressions::Expression createUnaryExpression(std::vector< storm::expressions::OperatorType > const &operatorType, storm::expressions::Expression const &e1, bool &pass) const
storm::expressions::Expression createPowerModuloLogarithmExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createAndExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
storm::expressions::Expression createMinimumMaximumExpression(storm::expressions::Expression const &e1, storm::expressions::OperatorType const &operatorType, storm::expressions::Expression const &e2, bool &pass) const
#define STORM_LOG_ERROR(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
Expression maximum(Expression const &first, Expression const &second)
Expression atLeastOneOf(std::vector< Expression > const &expressions)
Expression round(Expression const &first)
Expression ceil(Expression const &first)
Expression ite(Expression const &condition, Expression const &thenExpression, Expression const &elseExpression)
Expression iff(Expression const &first, Expression const &second)
Expression exactlyOneOf(std::vector< Expression > const &expressions)
Expression atMostOneOf(std::vector< Expression > const &expressions)
Expression minimum(Expression const &first, Expression const &second)
Expression floor(Expression const &first)
Expression pow(Expression const &base, Expression const &exponent, bool allowIntegerType)
The type of the resulting expression is.
Expression logarithm(Expression const &first, Expression const &second)
Expression implies(Expression const &first, Expression const &second)
bool isInteger(ValueType const &number)