From d21d2ca7e693c9b74d69d6fa866385853550f252 Mon Sep 17 00:00:00 2001 From: hannah Date: Wed, 23 Jun 2021 09:24:34 +0200 Subject: [PATCH] fixed exceptions --- src/storm/automata/APSet.cpp | 13 ++++++------- src/storm/automata/LTL2DeterministicAutomaton.cpp | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/storm/automata/APSet.cpp b/src/storm/automata/APSet.cpp index 937207215..6c136effd 100644 --- a/src/storm/automata/APSet.cpp +++ b/src/storm/automata/APSet.cpp @@ -1,5 +1,7 @@ #include "storm/automata/APSet.h" +#include "storm/exceptions/UnexpectedException.h" +#include "storm/utility/macros.h" #include #include @@ -20,13 +22,12 @@ namespace storm { } void APSet::add(const std::string& ap) { - if (size() >= MAX_APS) - throw std::runtime_error("Set of atomic proposition size is limited to " + std::to_string(MAX_APS)); + STORM_LOG_THROW(size() < MAX_APS, storm::exceptions::UnexpectedException, "Set of atomic proposition size is limited to " << std::to_string(MAX_APS)); unsigned int index = size(); bool fresh = ap_to_index.insert(std::make_pair(ap, index)).second; - if (!fresh) - throw std::runtime_error("Duplicate atomic proposition '" + ap + "' in APSet"); + STORM_LOG_THROW(fresh, storm::exceptions::UnexpectedException,"Duplicate atomic proposition '" << ap << "' in APSet"); + index_to_ap.push_back(ap); } @@ -54,9 +55,7 @@ namespace storm { } APSet::alphabet_element APSet::elementAddAP(alphabet_element element, unsigned int ap) const { - if (ap >= size()) { - throw std::runtime_error("AP out of range"); - } + STORM_LOG_THROW(ap < size(), storm::exceptions::UnexpectedException, "AP out of range"); return element | (1ul << ap); } diff --git a/src/storm/automata/LTL2DeterministicAutomaton.cpp b/src/storm/automata/LTL2DeterministicAutomaton.cpp index e2ff2863e..c70158354 100644 --- a/src/storm/automata/LTL2DeterministicAutomaton.cpp +++ b/src/storm/automata/LTL2DeterministicAutomaton.cpp @@ -15,8 +15,6 @@ #include "spot/twaalgos/translate.hh" #include "spot/twaalgos/hoa.hh" #include "spot/twaalgos/totgba.hh" -#include "spot/twaalgos/toparity.hh" -#include "spot/twa/acc.hh" #endif namespace storm {