Former-commit-id: d8aa9c1ba3
d8aa9c1ba3
@ -39,10 +39,16 @@ namespace storm {
return locations;
}
void Automaton::addLocation(Location const& location) {
uint64_t Automaton::addLocation(Location const& location) {
STORM_LOG_THROW(!this->hasLocation(location.getName()), storm::exceptions::WrongFormatException, "Cannot add location with name '" << location.getName() << "', because a location with this name already exists.");
locationToIndex.emplace(location.getName(), locations.size());
locations.push_back(location);
return locations.size() - 1;
uint64_t Automaton::getLocationId(std::string const& name) const {
assert(hasLocation(name));
return locationToIndex.at(name);
void Automaton::setInitialLocation(std::string const& name) {
@ -48,6 +48,14 @@ namespace storm {
*/
bool hasLocation(std::string const& name) const;
/*!
* Get location id for a location with a given name.
* Yields undefined behaviour if no such location exists;
*
* @name the name of the location
uint64_t getLocationId(std::string const& name) const;
* Retrieves the locations of the automaton.
@ -56,7 +64,7 @@ namespace storm {
* Adds the given location to the automaton.
void addLocation(Location const& location);
uint64_t addLocation(Location const& location);
* Uses the location with the given name as the initial location.