Fixes #1369 by removing any redundant edges.

This commit is contained in:
parrt 2016-11-17 12:41:32 -08:00
parent 1aa3c957eb
commit 125a509e4e
1 changed files with 12 additions and 10 deletions

View File

@ -192,18 +192,20 @@ public abstract class ATNState {
} }
boolean alreadyPresent = false; boolean alreadyPresent = false;
// for (Transition t : transitions) { for (Transition t : transitions) {
// if ( t.target.stateNumber == e.target.stateNumber ) { if ( t.target.stateNumber == e.target.stateNumber ) {
// if ( t.label()!=null && e.label()!=null && t.label().equals(e.label()) ) { if ( t.label()!=null && e.label()!=null && t.label().equals(e.label()) ) {
// System.err.println("Repeated transition upon "+e.label()+" from "+stateNumber+"->"+t.target.stateNumber); // System.err.println("Repeated transition upon "+e.label()+" from "+stateNumber+"->"+t.target.stateNumber);
// alreadyPresent = true; alreadyPresent = true;
// } break;
// else if ( t.isEpsilon() && e.isEpsilon() ) { }
else if ( t.isEpsilon() && e.isEpsilon() ) {
// System.err.println("Repeated epsilon transition from "+stateNumber+"->"+t.target.stateNumber); // System.err.println("Repeated epsilon transition from "+stateNumber+"->"+t.target.stateNumber);
// alreadyPresent = true; alreadyPresent = true;
// } break;
// } }
// } }
}
if ( !alreadyPresent ) { if ( !alreadyPresent ) {
transitions.add(index, e); transitions.add(index, e);
} }