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

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


     */
    public void testSpaceNegatedAsciiCharacter() {
        ArrayList<String> params = new ArrayList<String>();
        params.add("space");
        RegexpOperator spec = (new NegatedAsciiCharacterClass.Factory()).createOperator(params);
        NondeterministicAutomatonByThompsonApproach automaton =
            new NondeterministicAutomatonByThompsonApproach(spec.createAutomaton(
                new ArrayList<AutomatonSpecification>()));
        assertFalse(automaton.accepts("\u000B"));
        assertFalse(automaton.accepts("\t"));
        assertFalse(automaton.accepts("\n"));
        assertFalse(automaton.accepts("\f"));
        assertTrue(automaton.accepts("a"));
        assertTrue(automaton.accepts("Z"));
        assertTrue(automaton.accepts("9"));
        assertFalse(automaton.accepts("gfgh"));
    }
View Full Code Here


     */
    public void testUpperNegatedAsciiCharacter() {
        ArrayList<String> params = new ArrayList<String>();
        params.add("upper");
        RegexpOperator spec = (new NegatedAsciiCharacterClass.Factory()).createOperator(params);
        NondeterministicAutomatonByThompsonApproach automaton =
            new NondeterministicAutomatonByThompsonApproach(spec.createAutomaton(
                new ArrayList<AutomatonSpecification>()));
        assertFalse(automaton.accepts("A"));
        assertFalse(automaton.accepts("C"));
        assertFalse(automaton.accepts("G"));
        assertFalse(automaton.accepts("Z"));
        assertTrue(automaton.accepts("a"));
        assertTrue(automaton.accepts("s"));
        assertTrue(automaton.accepts("9"));
        assertFalse(automaton.accepts("asdww"));
    }
View Full Code Here

     */
    public void testWordNegatedAsciiCharacter() {
        ArrayList<String> params = new ArrayList<String>();
        params.add("word");
        RegexpOperator spec = (new NegatedAsciiCharacterClass.Factory()).createOperator(params);
        NondeterministicAutomatonByThompsonApproach automaton =
            new NondeterministicAutomatonByThompsonApproach(spec.createAutomaton(
                new ArrayList<AutomatonSpecification>()));
        assertFalse(automaton.accepts("a"));
        assertFalse(automaton.accepts("B"));
        assertFalse(automaton.accepts("_"));
        assertFalse(automaton.accepts("9"));
        assertTrue(automaton.accepts("!"));
        assertTrue(automaton.accepts("("));
        assertTrue(automaton.accepts("%"));
        assertFalse(automaton.accepts("dadada"));
        assertFalse(automaton.accepts(""));
    }
View Full Code Here

     */
    public void testXdigitNegatedAsciiCharacter() {
        ArrayList<String> params = new ArrayList<String>();
        params.add("xdigit");
        RegexpOperator spec = (new NegatedAsciiCharacterClass.Factory()).createOperator(params);
        NondeterministicAutomatonByThompsonApproach automaton =
            new NondeterministicAutomatonByThompsonApproach(spec.createAutomaton(
                new ArrayList<AutomatonSpecification>()));
        assertFalse(automaton.accepts("0"));
        assertFalse(automaton.accepts("8"));
        assertFalse(automaton.accepts("A"));
        assertFalse(automaton.accepts("f"));
        assertFalse(automaton.accepts("F"));
        assertFalse(automaton.accepts("a"));
        assertTrue(automaton.accepts("!"));
        assertTrue(automaton.accepts("("));
        assertTrue(automaton.accepts("%"));
        assertFalse(automaton.accepts("sfggg"));
    }
View Full Code Here

        automaton.markAsFinal(q1);

        MinimumNumberOfOccurencesOperator oper =
                new MinimumNumberOfOccurencesOperator(3);

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


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

        automaton.markAsFinal(q2);

        MinimumNumberOfOccurencesOperator oper =
                new MinimumNumberOfOccurencesOperator(2);

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

        assertTrue(result.accepts("aaaa"));
        assertTrue(result.accepts("abbaaba"));
        assertTrue(result.accepts("aaabaabba"));
        assertTrue(result.accepts("aaabaabbaabbbaabbbba"));
        assertFalse(result.accepts("abc"));
        assertFalse(result.accepts("aa"));
        assertFalse(result.accepts("LegueOfLegends"));
    }
View Full Code Here

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

        MinimumNumberOfOccurencesOperator oper =
            new MinimumNumberOfOccurencesOperator(10);

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

        assertFalse(result.accepts("aaaaaaaaaaaaaaaaaaaaaaaa"));
        assertFalse(result.accepts(""));
        assertFalse(result.accepts("a"));
        assertFalse(result.accepts("aaa"));
        assertFalse(result.accepts("Zonk"));
    }
View Full Code Here

        automaton.markAsFinal(q2);

        MinimumNumberOfOccurencesOperator oper =
            new MinimumNumberOfOccurencesOperator(3);

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

        assertTrue(result.accepts("aaaa"));
        assertTrue(result.accepts("bbbbbb"));
        assertTrue(result.accepts("bbabab"));
        assertTrue(result.accepts("aababa"));
        assertFalse(result.accepts("ab"));
        assertFalse(result.accepts("aa"));
        assertFalse(result.accepts("a"));
        assertFalse(result.accepts("b"));
        assertFalse(result.accepts(""));
        assertFalse(result.accepts("ZlyTekst"));
    }
View Full Code Here

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

        MinimumNumberOfOccurencesOperator oper =
            new MinimumNumberOfOccurencesOperator(0);

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

        assertTrue(result.accepts(""));
        assertFalse(result.accepts("a"));
        assertFalse(result.accepts("aaa"));
        assertFalse(result.accepts("Zonk"));
    }
View Full Code Here

        MinimumNumberOfOccurencesOperator oper =
            new MinimumNumberOfOccurencesOperator(3);


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

        assertTrue(result.accepts("acbbdabdda"));
        assertTrue(result.accepts("ababab"));
        assertTrue(result.accepts("abbaab"));
        assertTrue(result.accepts("accccccbbdddaab"));
        assertFalse(result.accepts("aaa"));
        assertFalse(result.accepts("abba"));
        assertFalse(result.accepts("Zonk"));
    }
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.