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

Merge branch 'issue671'

parents 4a756eb0 0dbc9d1f
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,34 @@ const set<TransitionFSM>& FSM::getTransitions() const {
return transitions;
}
 
const set<TransitionFSM>& FSM::getTransitionsFromState(const State& from) const {
if( states.find(from) == states.end())
throw AutomatonException("State \"" + from.getName() + "\" doesn't exist");
set<TransitionFSM> transitionsFromState;
for(auto const& transition : transitions){
if (transition.getFrom() == from){
transitionsFromState.insert(transition);
}
}
return transitions;
}
const set<TransitionFSM>& FSM::getTransitionsToState(const State& to) const {
if( states.find(to) == states.end())
throw AutomatonException("State \"" + to.getName() + "\" doesn't exist");
set<TransitionFSM> transitionsToState;
for(auto const& transition : transitions){
if (transition.getTo() == to){
transitionsToState.insert(transition);
}
}
return transitions;
}
void FSM::toXML(ostream& out) const {
AutomatonPrinter::toXML(*this, out);
}
......
......@@ -67,6 +67,16 @@ public:
*/
const set<TransitionFSM>& getTransitions() const;
 
/**
* @return automaton transitions from state
*/
const set<TransitionFSM>& getTransitionsFromState(const State& from) const;
/**
* @return automaton transitions from state
*/
const set<TransitionFSM>& getTransitionsToState(const State& to) const;
/**
* Determines whether FSM contains epsilon transitions.
* @return true when automaton doesn't contain epsilon transitions, false otherwise
......
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