*/
private static int initObservables(final List<EnterableState>states, int nextObservableId) {
for (EnterableState es : states) {
es.setObservableId(nextObservableId++);
if (es instanceof TransitionalState) {
TransitionalState ts = (TransitionalState)es;
if (ts instanceof State) {
State s = (State)ts;
if (s.getInitial() != null && s.getInitial().getTransition() != null) {
s.getInitial().getTransition().setObservableId(nextObservableId++);
}
}
for (Transition t : ts.getTransitionsList()) {
t.setObservableId(nextObservableId++);
}
for (History h : ts.getHistory()) {
h.setObservableId(nextObservableId++);
if (h.getTransition() != null) {
h.getTransition().setObservableId(nextObservableId++);
}
}
nextObservableId = initObservables(ts.getChildren(), nextObservableId);
}
}
return nextObservableId;
}