diff --git a/src/storm/storage/jani/Model.cpp b/src/storm/storage/jani/Model.cpp index 1f219a60d..bc8c687c7 100644 --- a/src/storm/storage/jani/Model.cpp +++ b/src/storm/storage/jani/Model.cpp @@ -637,6 +637,22 @@ namespace storm { bool Model::hasConstant(std::string const& name) const { return constantToIndex.find(name) != constantToIndex.end(); } + + + void Model::removeConstant(std::string const& name) { + auto pos = constantToIndex.find(name); + if (pos != constantToIndex.end()) { + uint64_t index = pos->second; + constants.erase(constants.begin() + index); + constantToIndex.erase(pos); + for (auto& entry : constantToIndex) { + if(entry.second > index) { + entry.second--; + } + } + } + + } Constant const& Model::getConstant(std::string const& name) const { auto it = constantToIndex.find(name); diff --git a/src/storm/storage/jani/Model.h b/src/storm/storage/jani/Model.h index 36cae30ca..656003853 100644 --- a/src/storm/storage/jani/Model.h +++ b/src/storm/storage/jani/Model.h @@ -169,6 +169,11 @@ namespace storm { * Retrieves whether the model has a constant with the given name. */ bool hasConstant(std::string const& name) const; + + /*! + * Removes (without checks) a constant from the model. + */ + void removeConstant(std::string const& name); /*! * Retrieves the constants of the model.