diff --git a/alib2algo/src/automaton/simplify/Total.h b/alib2algo/src/automaton/simplify/Total.h index 33491bd7eaf9cb2d63c303a87d1b4cb7eaef7b57..99cad48f19148f84498b068ed0d1cf60cc5bfb84 100644 --- a/alib2algo/src/automaton/simplify/Total.h +++ b/alib2algo/src/automaton/simplify/Total.h @@ -61,18 +61,14 @@ public: template < class SymbolType, class StateType > automaton::NFA < SymbolType, StateType > Total::total(const automaton::NFA < SymbolType, StateType > & automaton) { - if(! automaton.isDeterministic()) { - throw exception::CommonException("Automaton must be deterministic to make its transition function total"); - } - automaton::NFA < SymbolType, StateType > res(automaton); StateType nullState = common::createUnique(label::FailStateLabel::instance < StateType > ( ), automaton.getStates()); res.addState(nullState); for(const auto& q : res.getStates()) { for(const auto& a : res.getInputAlphabet()) { - if(res.getTransitions().find(ext::make_pair(q, a)) == res.getTransitions().end()) { - res.addTransition(q, a, nullState); + if ( res.getTransitions ( ).find ( ext::make_pair ( q, a ) ) == res.getTransitions ( ).end ( ) || res.getTransitions ( ).at ( ext::make_pair ( q, a ) ).size ( ) == 0 ) { + res.addTransition ( q, a, nullState ); } } }