CA initial state

This commit is contained in:
Artur Meski
2018-03-04 15:32:16 +00:00
parent 18004b916e
commit f55d433791
6 changed files with 36 additions and 3 deletions

View File

@@ -40,9 +40,23 @@ void CtxAut::addState(std::string name)
states_ids.push_back(name);
states_names[name] = new_state_id;
if (!init_state_defined)
{
setInitState(name);
}
}
}
void CtxAut::setInitState(std::string name)
{
VERB_L2("Setting initial CA state: " << name);
State state_id = getStateID(name);
VERB_L2("Got initial CA state ID: index=" << state_id);
init_state_id = state_id;
init_state_defined = true;
}
void CtxAut::printAutomaton(void)
{
showStates();
@@ -52,6 +66,7 @@ void CtxAut::printAutomaton(void)
void CtxAut::showStates(void)
{
cout << "# Context Automaton States:" << endl;
cout << " = Init state: " << getStateName(init_state_id) << endl;
for (const auto &s : states_ids)
cout << " * " << s << endl;
}