Skip to content
Snippets Groups Projects
Commit 579c5321 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix automata Occurrences runner

parent 06afbb98
No related branches found
No related tags found
No related merge requests found
...@@ -34,8 +34,11 @@ std::set<unsigned> Occurrences::occurrences(const automaton::DFA& automaton, con ...@@ -34,8 +34,11 @@ std::set<unsigned> Occurrences::occurrences(const automaton::DFA& automaton, con
   
auto transitions = automaton.getTransitionsFromState(state); auto transitions = automaton.getTransitionsFromState(state);
auto next = transitions.find(std::make_pair(state, symbol)); auto next = transitions.find(std::make_pair(state, symbol));
if(next == transitions.end()) return {}; if(next == transitions.end()) { //makes sence to reset the automaton when there is "unknown" symbol on the input
state = next->second; state = automaton.getInitialState();
} else {
state = next->second;
}
   
i++; i++;
} }
......
<LinearString><alphabet><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol></alphabet><content><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol></content></LinearString>
<LinearString><alphabet><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol></alphabet><content><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>a</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>b</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol><LabeledSymbol><PrimitiveLabel><Character>c</Character></PrimitiveLabel></LabeledSymbol></content></LinearString>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment