o.a.l.u.automaton.Automaton api has changed in lucene 4.10 (
https://issues.apache.org/jira/secure/attachment/12651171/LUCENE-5752.patch
).
Method getNumberedStates() got dropped. class State does not exist anymore.
In the Automaton api before 4.10 the traversal could be achieved like this:
// Automaton a;
State[] states = a.getNumberedStates();
for (State s : states) {
StringBuilder msg = new StringBuilder();
msg.append(String.valueOf(s.getNumber()));
if (a.getInitialState() == s) {
msg.append(" INITIAL");
}
msg.append(s.isAccept() ? " [accept]" : " [reject]");
msg.append(", " + s.numTransitions + " transitions");
for (Transition t : s.getTransitions()) {
// do something with transitions
}
log.info(msg);
}
Can anybody help on how to traverse an existing Automaton object with new
api?
Thanks,
Dmitry