while (current < rules.length && worklist.size() == 0) {
// Check whether state is reachable and that it's a term. This is
// because only reachable states should be rewritten; and, only
// terms can be roots of rewrite rules.
RewriteRule rw = rules[current];
for(int i=0;i!=nStates;++i) {
if (reachable[i]
&& automaton.get(i) instanceof Automaton.Term) {
rw.probe(automaton, i, worklist);
numProbes++;
}
}
current = current + 1;
}