Try looking at the sources for Automaton.toDot?  It does a similar traversal...

Mike McCandless

http://blog.mikemccandless.com


On Tue, Sep 23, 2014 at 9:50 AM, Dmitry Kan <[email protected]> wrote:
> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to