Package pl.edu.amu.wmi.daut.base

Examples of pl.edu.amu.wmi.daut.base.NondeterministicAutomatonByThompsonApproach


     */
    public void testAutomaton() {

        BellCharacterOperator operator = new BellCharacterOperator();
        AutomatonSpecification aut = operator.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach a
            = new NondeterministicAutomatonByThompsonApproach(aut);

        assertTrue(a.accepts(Character.toString('\7')));
        assertFalse(a.accepts(Character.toString('8')));
        assertFalse(a.accepts(Character.toString('c')));
        assertTrue(a.accepts(Character.toString((char) 7)));
        assertFalse(a.accepts(Character.toString(' ')));
        assertFalse(a.accepts(Character.toString('\6')));
    }
View Full Code Here


        automaton2.markAsInitial(q2);
        automaton2.markAsFinal(q3);

        AlternativeOperator oper = new AlternativeOperator();
        NondeterministicAutomatonByThompsonApproach result =
        new NondeterministicAutomatonByThompsonApproach(
                oper.createAutomatonFromTwoAutomata(automaton1, automaton2));

        assertTrue(result.accepts("aaaa"));
        assertTrue(result.accepts("bbaaaa"));
        assertTrue(result.accepts("aaaaaaaaaaaabaaaaaa"));
        assertTrue(result.accepts("bbb"));
        assertTrue(result.accepts("baba"));
        assertTrue(result.accepts("bababab"));
        assertFalse(result.accepts(""));
        assertFalse(result.accepts("jakasbzdura"));
        assertFalse(result.accepts("bb"));
        assertFalse(result.accepts("kabaczek"));
    }
View Full Code Here

        automaton1.markAsFinal(q2);

        AutomatonSpecification automaton2 = new NaiveAutomatonSpecification();

        AlternativeOperator oper = new AlternativeOperator();
        NondeterministicAutomatonByThompsonApproach result =
        new NondeterministicAutomatonByThompsonApproach(
                oper.createAutomatonFromTwoAutomata(automaton1, automaton2));

        assertTrue(result.accepts("abab"));
        assertTrue(result.accepts("ababababababab"));
        assertFalse(result.accepts(""));
        assertFalse(result.accepts("cosdziwnego"));
        assertFalse(result.accepts("baaaaaaaaaa"));
        assertFalse(result.accepts("abababababb"));
        assertFalse(result.accepts("bababa"));
    }
View Full Code Here

        automaton.markAsInitial(q0);
        automaton.markAsFinal(q2);

        OptionalityOperator operator = new OptionalityOperator();
        NondeterministicAutomatonByThompsonApproach result =
            new NondeterministicAutomatonByThompsonApproach(
                operator.createAutomatonFromOneAutomaton(automaton));

        assertTrue(result.accepts("aaabbb"));
        assertTrue(result.accepts("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb"));
        assertTrue(result.accepts("aabbbbbbbbbbbbb"));
        assertTrue(result.accepts("ab"));
        assertTrue(automaton.acceptEmptyWord());

        assertFalse(result.accepts("aaabbbbaabbbbab"));
        assertFalse(result.accepts("aaaaaaaaaaa"));
        assertFalse(result.accepts("cojapacze"));
        assertFalse(result.accepts("macrimnatueshzanc"));
        assertFalse(result.accepts("katrayzniaedc"));
        assertFalse(result.accepts("jestemglupimstringieminicnieznacze"));
        assertFalse(result.accepts("jestemautomateminieakceptuje"));
    }
View Full Code Here

        automaton.markAsInitial(q0);
        automaton.markAsFinal(q2);

        AtLeastOneOperator operator = new AtLeastOneOperator();
        NondeterministicAutomatonByThompsonApproach result =
        new NondeterministicAutomatonByThompsonApproach(
                operator.createAutomatonFromOneAutomaton(automaton));

        assertTrue(result.accepts("aaaab"));
        assertTrue(result.accepts("abbbbb"));
        assertTrue(result.accepts("aaaaaaaaaaaabb"));
        assertTrue(result.accepts("abbbaaaab"));
        assertTrue(result.accepts("abababb"));

        assertFalse(automaton.acceptEmptyWord());
        assertFalse(result.accepts("baba"));
        assertFalse(result.accepts("baaaaaaaaa"));
        assertFalse(result.accepts("cojatestujem"));
        assertFalse(result.accepts("bartlomiejburczymucha"));
    }
View Full Code Here

TOP

Related Classes of pl.edu.amu.wmi.daut.base.NondeterministicAutomatonByThompsonApproach

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.