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

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


        RegexpOperatorTree tree = new RegexpOperatorTree(root, subtrees);

        //Tworzymy automat dla tego drzewa.
        AutomatonSpecification automaton =
                RegexpUtilities.createAutomatonFromOperatorTree(tree);
        NondeterministicAutomatonByThompsonApproach result =
                new NondeterministicAutomatonByThompsonApproach(automaton);

        //Testujemy.
        assertTrue(result.accepts(""));
        assertTrue(result.accepts("a"));
        assertTrue(result.accepts("b"));
        assertTrue(result.accepts("c"));
        assertTrue(result.accepts("cccccccc"));
        assertFalse(result.accepts("abcccc"));
        assertFalse(result.accepts("abc"));
        assertFalse(result.accepts("aaaaa"));
        assertFalse(result.accepts("testujtest"));
    }
View Full Code Here


        RegexpOperatorTree tree = new RegexpOperatorTree(root, subtrees);

        //Tworzymy automat dla tego drzewa.
        AutomatonSpecification automaton =
                RegexpUtilities.createAutomatonFromOperatorTree(tree);
        NondeterministicAutomatonByThompsonApproach result =
                new NondeterministicAutomatonByThompsonApproach(automaton);

        //Testujemy.
        assertTrue(result.accepts("a"));
        assertTrue(result.accepts("aaaaaaa"));
        assertTrue(result.accepts("b"));
        assertTrue(result.accepts("bbbbb"));
        assertTrue(result.accepts("ab"));
        assertTrue(result.accepts("abaaaabbb"));
        assertTrue(result.accepts(""));
        assertTrue(result.accepts("ccc"));
        assertTrue(result.accepts("de"));
        assertTrue(result.accepts("deeeeeeee"));
        assertTrue(result.accepts("d"));
        assertFalse(result.accepts("abbbbc"));
        assertFalse(result.accepts("dddd"));
        assertFalse(result.accepts("eeeee"));
        assertFalse(result.accepts("testujtest"));
    }
View Full Code Here

        automaton.markAsFinal(q1);

        FixedNumberOfOccurrencesOperator oper =
                new FixedNumberOfOccurrencesOperator(4);

        NondeterministicAutomatonByThompsonApproach result =
            new NondeterministicAutomatonByThompsonApproach(
            oper.createAutomatonFromOneAutomaton(automaton));


        assertTrue(result.accepts("aaaa"));
        assertFalse(result.accepts(""));
        assertFalse(result.accepts("a"));
        assertFalse(result.accepts("aa"));
        assertFalse(result.accepts("aaa"));
        assertFalse(result.accepts("aaaaa"));
        assertFalse(result.accepts("ManchesterUnited"));
    }
View Full Code Here

        automaton.markAsFinal(q4);

        FixedNumberOfOccurrencesOperator oper =
                new FixedNumberOfOccurrencesOperator(2);

        NondeterministicAutomatonByThompsonApproach result =
        new NondeterministicAutomatonByThompsonApproach(
                oper.createAutomatonFromOneAutomaton(automaton));

        assertTrue(result.accepts("aacdbaacdb"));
        assertTrue(result.accepts("acbacb"));
        assertTrue(result.accepts("abbababbab"));
        assertFalse(result.accepts("aacbc"));
        assertFalse(result.accepts("aacdb"));
        assertFalse(result.accepts("acbacbacb"));
        assertFalse(result.accepts("false"));
        assertFalse(result.accepts("ManchesterUnited"));
    }
View Full Code Here

          AutomatonSpecification automaton = new NaiveAutomatonSpecification();

          FixedNumberOfOccurrencesOperator oper =
                new FixedNumberOfOccurrencesOperator(666);

          NondeterministicAutomatonByThompsonApproach result =
                new NondeterministicAutomatonByThompsonApproach(
                oper.createAutomatonFromOneAutomaton(automaton));

          assertFalse(result.accepts("ManchesterUnited"));
     }
View Full Code Here

        automaton.markAsFinal(q2);

        FixedNumberOfOccurrencesOperator oper =
                new FixedNumberOfOccurrencesOperator(3);

        NondeterministicAutomatonByThompsonApproach result =
        new NondeterministicAutomatonByThompsonApproach(
                oper.createAutomatonFromOneAutomaton(automaton));


        assertTrue(result.accepts("aaa"));
        assertTrue(result.accepts("bba"));
        assertTrue(result.accepts("aab"));
        assertFalse(result.accepts("aabb"));
        assertFalse(result.accepts("ab"));
        assertFalse(result.accepts("b"));
        assertFalse(result.accepts("LechPoznan"));
}
View Full Code Here

        automaton.markAsFinal(q1);

        FixedNumberOfOccurrencesOperator oper =
                new FixedNumberOfOccurrencesOperator(0);

        NondeterministicAutomatonByThompsonApproach result =
                new NondeterministicAutomatonByThompsonApproach(
                oper.createAutomatonFromOneAutomaton(automaton));

        assertTrue(result.accepts(""));
        assertFalse(result.accepts("ManchesterUnited"));
        assertFalse(result.accepts("b"));
        assertFalse(result.accepts("bbbb"));
     }
View Full Code Here

        a2.markAsInitial(q0c);
        a2.markAsFinal(q2c);

        ConcatenationOperator con = new ConcatenationOperator();
        NondeterministicAutomatonByThompsonApproach result =
        new NondeterministicAutomatonByThompsonApproach(
                con.createAutomatonFromTwoAutomata(a1, a2));

        assertTrue(result.accepts("abbbaaaacc"));
        assertTrue(result.accepts("ababababcaaaaaac"));
        assertTrue(result.accepts("aaaaaaaaaaaabaaaaaacaaaaaacaaaaa"));
        assertTrue(result.accepts("bcc"));
        assertFalse(result.accepts("aabaaba"));
        assertFalse(result.accepts("abbca"));
        assertFalse(result.accepts("aaaacc"));
        assertFalse(result.accepts(""));
        assertFalse(result.accepts("cokolwiek"));
        assertFalse(result.accepts("bbaccab"));
        assertFalse(result.accepts("ccabba"));
    }
View Full Code Here

     */
    public final void testCreateFixedAutomaton() {

        OctSingleCharacterOperator operator = new OctSingleCharacterOperator(120);
        AutomatonSpecification automaton = operator.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result =
                new NondeterministicAutomatonByThompsonApproach(automaton);

        assertFalse(automaton.isEmpty());

        assertTrue(result.accepts("P"));
        assertFalse(result.accepts("PP"));
        assertFalse(result.accepts(" P"));
        assertFalse(result.accepts("cc"));
        assertFalse(result.accepts("a"));

        assertEquals(120, operator.getOctValue());
    }
View Full Code Here

        State q0 = subautomaton.addState();
        subautomaton.markAsInitial(q0);
        subautomaton.markAsFinal(q0);

        DoNothingOperator operator = new DoNothingOperator();
        NondeterministicAutomatonByThompsonApproach automaton =
                new NondeterministicAutomatonByThompsonApproach(
                operator.createAutomatonFromOneAutomaton(subautomaton));

        assertTrue(automaton.accepts(""));
        assertFalse(automaton.accepts("word"));
    }
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.