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

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


     * Test znaku ucieczki "\r".
     */
    public void testEscapeOperatorR() {

        EscapeOperator operator4 = new EscapeOperator('r');
        AutomatonSpecification automaton4 = operator4.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result4 =
                new NondeterministicAutomatonByThompsonApproach(automaton4);

        assertFalse(automaton4.isEmpty());
        assertTrue(result4.accepts("\r"));
        assertFalse(result4.accepts("\\rr"));
        assertFalse(result4.accepts("r"));
    }
View Full Code Here


     * Test zwyklego znaku.
     */
    public void testEscapeOperatorI() {

        EscapeOperator operator5 = new EscapeOperator('i');
        AutomatonSpecification automaton5 = operator5.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result5 =
                new NondeterministicAutomatonByThompsonApproach(automaton5);

        assertFalse(automaton5.isEmpty());
        assertTrue(result5.accepts("i"));
        assertFalse(result5.accepts("\\ii"));
        assertFalse(result5.accepts("\\i"));
    }
View Full Code Here

     * Test znaku ucieczki "\v".
     */
    public void testEscapeOperatorV() {

        EscapeOperator operator6 = new EscapeOperator('v');
        AutomatonSpecification automaton6 = operator6.createFixedAutomaton();
        NondeterministicAutomatonByThompsonApproach result6 =
                new NondeterministicAutomatonByThompsonApproach(automaton6);

        assertFalse(automaton6.isEmpty());
        assertTrue(result6.accepts("\13"));
        assertFalse(result6.accepts("\\1313"));
        assertFalse(result6.accepts("13"));
    }
View Full Code Here

     * Test automatu akceptujący słowo puste.
     */

    public final void testZeroRepeats() {

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

        MinimumNumberOfOccurencesOperator oper =
            new MinimumNumberOfOccurencesOperator(0);

        NondeterministicAutomatonByThompsonApproach result =
View Full Code Here

     *  Automat akceptuje słowo (ac^nb)||(bd^na).
     */

    public final void testAlternativeLoops() {

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

        State q0 = automaton.addState();
        State q1 = automaton.addState();
        State q2 = automaton.addState();
        State q3 = automaton.addState();
        State q4 = automaton.addState();
        automaton.addTransition(q0, q1, new CharTransitionLabel('a'));
        automaton.addTransition(q0, q2, new CharTransitionLabel('b'));
        automaton.addTransition(q1, q3, new CharTransitionLabel('b'));
        automaton.addTransition(q2, q4, new CharTransitionLabel('a'));
        automaton.addLoop(q1, new CharTransitionLabel('c'));
        automaton.addLoop(q2, new CharTransitionLabel('d'));


        automaton.markAsInitial(q0);
        automaton.markAsFinal(q3);
        automaton.markAsFinal(q4);

        MinimumNumberOfOccurencesOperator oper =
            new MinimumNumberOfOccurencesOperator(3);


View Full Code Here

     * Test metody createFixedAutomaton.
     */
    public void testCreateFixedAutomaton() {

        NoDigitOperator operator = new NoDigitOperator();
        AutomatonSpecification spec = operator.createFixedAutomaton();
        assertFalse(spec.isEmpty());
        assertFalse(spec.acceptEmptyWord());

        AutomatonByRecursion noDigitAutomaton = new AutomatonByRecursion(spec);
        assertFalse(noDigitAutomaton.accepts("0"));
        assertFalse(noDigitAutomaton.accepts("1"));
        assertFalse(noDigitAutomaton.accepts("2"));
View Full Code Here

        RegexpOperator root = new SingleCharacterOperator('a');
        List<RegexpOperatorTree> subtrees = new ArrayList<RegexpOperatorTree>();
        RegexpOperatorTree tree = new RegexpOperatorTree(root, subtrees);

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

        //Testujemy.
View Full Code Here

        subtrees.add(subtree1);
        subtrees.add(subtree2);
        RegexpOperatorTree tree = new RegexpOperatorTree(root, subtrees);

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

        //Testujemy.
View Full Code Here

        subtrees.add(subtree1);
        subtrees.add(subtree2);
        RegexpOperatorTree tree = new RegexpOperatorTree(root, subtrees);

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

        //Testujemy.
View Full Code Here

        subtrees.add(subtree6);
        subtrees.add(subtree5);
        RegexpOperatorTree tree = new RegexpOperatorTree(root, subtrees);

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

        //Testujemy.
View Full Code Here

TOP

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

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.