ATNSimulator.deserialize computes values for PlusBlockStartState.loopBackState and StarLoopEntryState.loopBackState

This commit is contained in:
Sam Harwell 2012-08-12 11:52:05 -05:00
parent 83d8903f9f
commit 9b42acbf4d
1 changed files with 21 additions and 0 deletions

View File

@ -179,6 +179,27 @@ public abstract class ATNSimulator {
}
}
for (ATNState state : atn.states) {
if (state instanceof PlusLoopbackState) {
PlusLoopbackState loopbackState = (PlusLoopbackState)state;
for (int i = 0; i < loopbackState.getNumberOfTransitions(); i++) {
ATNState target = loopbackState.transition(i).target;
if (target instanceof PlusBlockStartState) {
((PlusBlockStartState)target).loopBackState = loopbackState;
}
}
}
else if (state instanceof StarLoopbackState) {
StarLoopbackState loopbackState = (StarLoopbackState)state;
for (int i = 0; i < loopbackState.getNumberOfTransitions(); i++) {
ATNState target = loopbackState.transition(i).target;
if (target instanceof StarLoopEntryState) {
((StarLoopEntryState)target).loopBackState = loopbackState;
}
}
}
}
//
// DECISIONS
//