Use for each instead of indexed for; use isEmpty() instead of size()==0

This commit is contained in:
sharwell 2012-02-08 17:06:03 -06:00
parent 326cb259a0
commit 52256044a9
1 changed files with 2 additions and 3 deletions

View File

@ -288,8 +288,7 @@ public class LexerATNSimulator extends ATNSimulator {
System.out.format("in reach starting closure: %s\n", closure); System.out.format("in reach starting closure: %s\n", closure);
} }
for (int ci=0; ci<closure.size(); ci++) { // TODO: foreach for (ATNConfig c : closure) {
ATNConfig c = closure.get(ci);
if ( debug ) { if ( debug ) {
System.out.format("testing %s at %s\n", getTokenName(t), c.toString(recog, true)); System.out.format("testing %s at %s\n", getTokenName(t), c.toString(recog, true));
} }
@ -304,7 +303,7 @@ public class LexerATNSimulator extends ATNSimulator {
} }
} }
if ( reach.size()==0 ) { if ( reach.isEmpty() ) {
// we reached state associated with closure for sure, so // we reached state associated with closure for sure, so
// make sure it's defined. worst case, we define s0 from // make sure it's defined. worst case, we define s0 from
// start state configs. // start state configs.