12namespace expressions {
16 :
ArrayExpression(manager, type), sizeExpression(size), indexVar(indexVar), elementExpression(elementExpression) {
22 bool indexVarContained = variables.find(indexVar) != variables.end();
23 sizeExpression->gatherVariables(variables);
24 elementExpression->gatherVariables(variables);
25 if (!indexVarContained) {
26 variables.erase(indexVar);
31 if (sizeExpression->containsVariables()) {
35 std::set<storm::expressions::Variable> variables;
36 elementExpression->gatherVariables(variables);
37 variables.erase(indexVar);
38 return !variables.empty();
42 return std::shared_ptr<BaseExpression const>(
48 STORM_LOG_THROW(janiVisitor !=
nullptr, storm::exceptions::UnexpectedException,
"Visitor of jani expression should be of type JaniVisitor.");
49 return janiVisitor->visit(*
this, data);
53 stream <<
"array[ " << *elementExpression <<
" | " << indexVar.
getExpression() <<
" < " << *sizeExpression <<
" ]";
57 return sizeExpression;
61 std::map<storm::expressions::Variable, storm::expressions::Expression> substitution;
62 substitution.emplace(indexVar, this->
getManager().integer(i));
67 return elementExpression;
The base class of all array expressions.
ExpressionManager const & getManager() const
Retrieves the manager responsible for this expression.
Type const & getType() const
Retrieves the type of the expression.
Represents an array of the given size, where the i'th entry is determined by the elementExpression,...
virtual std::shared_ptr< BaseExpression const > size() const override
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.
virtual std::shared_ptr< BaseExpression const > at(uint64_t i) const override
virtual bool containsVariables() const override
Retrieves whether the expression contains a variable.
virtual void gatherVariables(std::set< storm::expressions::Variable > &variables) const override
Retrieves the set of all variables that appear in the expression.
ConstructorArrayExpression(ExpressionManager const &manager, Type const &type, std::shared_ptr< BaseExpression const > const &size, storm::expressions::Variable indexVar, std::shared_ptr< BaseExpression const > const &elementExpression)
virtual std::shared_ptr< BaseExpression const > simplify() const override
Simplifies the expression according to some simple rules.
std::shared_ptr< BaseExpression const > const & getElementExpression() const
storm::expressions::Variable const & getIndexVar() const
std::shared_ptr< BaseExpression const > const & getBaseExpressionPointer() const
Retrieves a pointer to the base expression underlying this expression object.
This class is responsible for managing a set of typed variables and all expressions using these varia...
storm::expressions::Expression getExpression() const
Retrieves an expression that represents the variable.
#define STORM_LOG_THROW(cond, exception, message)
storm::expressions::Expression substituteJaniExpression(storm::expressions::Expression const &expression, std::map< storm::expressions::Variable, storm::expressions::Expression > const &identifierToExpressionMap, bool const substituteTranscendentalNumbers)