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

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


    public void testcreateFixedAutomaton() {
         NoWhitespaceOperator operator = new NoWhitespaceOperator();
         AutomatonSpecification spec = operator.createFixedAutomaton();
         assertFalse(spec.isEmpty());
         assertFalse(spec.acceptEmptyWord());
         AutomatonByRecursion automaton = new AutomatonByRecursion(spec);

         assertFalse(automaton.accepts(" "));
         assertFalse(automaton.accepts("\n"));
         assertFalse(automaton.accepts("\t"));
         assertFalse(automaton.accepts("\f"));
         assertFalse(automaton.accepts("\u000B"));
         assertFalse(automaton.accepts("\r"));
         assertTrue(automaton.accepts("_"));
         assertTrue(automaton.accepts("a"));
         assertTrue(automaton.accepts("*"));
         assertTrue(automaton.accepts("9"));
    }
View Full Code Here


    /**
     * Konstruuje przykładowy automat, a następnie go testuje.
     */
    public void testAutomatonFirst() {

        AutomatonByRecursion tmp = new AutomatonByRecursion(
            new CharClassOperator("1-3").createFixedAutomaton());

        assertTrue(tmp.accepts("2"));
        assertFalse(tmp.accepts("4"));
        assertTrue(tmp.accepts("3"));
    }
View Full Code Here

        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"));
        assertFalse(noDigitAutomaton.accepts("3"));
        assertFalse(noDigitAutomaton.accepts("4"));
        assertFalse(noDigitAutomaton.accepts("5"));
        assertFalse(noDigitAutomaton.accepts("6"));
        assertFalse(noDigitAutomaton.accepts("7"));
        assertFalse(noDigitAutomaton.accepts("8"));
        assertFalse(noDigitAutomaton.accepts("9"));
        assertFalse(noDigitAutomaton.accepts("12"));
        assertFalse(noDigitAutomaton.accepts("123"));
        assertFalse(noDigitAutomaton.accepts("abc"));
        assertTrue(noDigitAutomaton.accepts("a"));
        assertTrue(noDigitAutomaton.accepts("b"));
        assertFalse(noDigitAutomaton.accepts(""));

    }
View Full Code Here

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

        AutomatonByRecursion automaton = new AutomatonByRecursion(spec);
        assertFalse(automaton.accepts("\n"));
        assertFalse(automaton.accepts("a"));
        assertFalse(automaton.accepts("b"));
        assertFalse(automaton.accepts("%"));
        assertFalse(automaton.accepts(" "));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("\r"));
        assertTrue(automaton.accepts("\t"));
        assertTrue(automaton.accepts(Character.toString((char) 9)));
    }
View Full Code Here

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

        AutomatonByRecursion automaton = new AutomatonByRecursion(spec);
        assertTrue(automaton.accepts("\13"));
        assertFalse(automaton.accepts("a"));
        assertFalse(automaton.accepts("%"));
        assertFalse(automaton.accepts("\t"));
        assertFalse(automaton.accepts(" "));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("\n"));
    }
View Full Code Here

        WhitespaceOperator operator = new WhitespaceOperator();
        AutomatonSpecification spec = operator.createFixedAutomaton();
        assertFalse(spec.isEmpty());
        assertFalse(spec.acceptEmptyWord());
        AutomatonByRecursion automaton = new AutomatonByRecursion(spec);
        assertTrue(automaton.accepts("\t"));
        assertTrue(automaton.accepts("\n"));
        assertTrue(automaton.accepts("\f"));
        assertTrue(automaton.accepts("\r"));
        assertTrue(automaton.accepts(" "));
        assertTrue(automaton.accepts("\u000B"));
        assertFalse(automaton.accepts("'"));
        assertFalse(automaton.accepts("%"));
        assertFalse(automaton.accepts("4"));
        assertFalse(automaton.accepts("0"));
    }
View Full Code Here

    /**
     * Konstruuje przykładowy automat, a następnie go testuje.
     */
    public void testAutomatonSecond() {

        AutomatonByRecursion tmp = new AutomatonByRecursion(
            new CharClassOperator("1-3a-c-").createFixedAutomaton());

        assertTrue(tmp.accepts("1"));
        assertFalse(tmp.accepts("4"));
        assertTrue(tmp.accepts("-"));
        assertFalse(tmp.accepts("d"));
        assertFalse(tmp.accepts("ą"));
        assertTrue(tmp.accepts("b"));
    }
View Full Code Here

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

        AutomatonByRecursion automaton = new AutomatonByRecursion(spec);
        assertTrue(automaton.accepts("\n"));
        assertFalse(automaton.accepts("a"));
        assertFalse(automaton.accepts("%"));
        assertFalse(automaton.accepts("\t"));
        assertFalse(automaton.accepts(" "));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("\r"));
    }
View Full Code Here

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

        AutomatonByRecursion automaton = new AutomatonByRecursion(spec);
        assertTrue(automaton.accepts("0"));
        assertTrue(automaton.accepts("9"));
        assertTrue(automaton.accepts("1"));
        assertTrue(automaton.accepts("7"));
        assertTrue(automaton.accepts("5"));
        assertFalse(automaton.accepts(""));
        assertFalse(automaton.accepts("a"));
        assertFalse(automaton.accepts("b"));
        assertFalse(automaton.accepts("93"));
        assertFalse(automaton.accepts("100"));
        assertFalse(automaton.accepts("207"));

    }
View Full Code Here

TOP

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

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.