Skip to content

prettyPrint() of automaton #25

@sunyixu

Description

@sunyixu

the method prettyPrint() prints strings that are not actually recognized by the automaton because the transitions of it do not reach a final state.
Example:

HashSet<State> statesR = new HashSet<>();
        HashSet<Transition> deltaR = new HashSet<>();
        State q00 = new State("q0", true, false);
        State q1 = new State("q1", false, false);
        State q2 = new State("q2", false, false);
        State q3 = new State("q3", false, false);
        statesR.add(q00);
        statesR.add(q1);
        statesR.add(q2);
        statesR.add(q3);
        deltaR.add(new Transition(q00, q1, "b"));
        deltaR.add(new Transition(q1, q2, "u"));
        deltaR.add(new Transition(q2, q3, "g"));
        FA result = new FA(new Automaton(deltaR, statesR));
        System.out.println("result --> " + result); //--> bug
        result.minimize();
        System.out.println("result after minimization --> " + result); //--> ε

In the example above, the automaton has no final state.
The first println will print "bug" while it should print "ε" as the second call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions