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

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


            AutomatonSpecification subautomaton) {

        AutomatonSpecification newAutomaton = new NaiveAutomatonSpecification();

        if (numberOfOccurences == 0) {
            State state = newAutomaton.addState();
            newAutomaton.markAsInitial(state);
            newAutomaton.markAsFinal(state);
        }

        if (numberOfOccurences > 0) {
            newAutomaton = subautomaton.clone();
            for (int i = 1; i < numberOfOccurences; i++) {
                State newState = newAutomaton.addState();

                for (State state : newAutomaton.allStates()) {
                    if (newAutomaton.isFinal(state)) {
                        newAutomaton.addTransition(state, newState, new EpsilonTransitionLabel());
                        newAutomaton.unmarkAsFinalState(state);
                    }
                }
                newAutomaton.insert(newState, subautomaton);
            }
            State newState = newAutomaton.addState();
            newAutomaton.insert(newState, subautomaton);
            for (State state : newAutomaton.allStates()) {
                if (newAutomaton.isFinal(state)) {
                    newAutomaton.addTransition(state, newState, new EpsilonTransitionLabel());
                }
View Full Code Here


    private static final String WHITESPACE_CHARS = "\t\n\f\r \u000B";

    @Override
    public AutomatonSpecification createFixedAutomaton() {
        AutomatonSpecification automaton = new NaiveAutomatonSpecification();
        State q0 = automaton.addState();
        State q1 = automaton.addState();
        automaton.markAsInitial(q0);
        automaton.markAsFinal(q1);
        automaton.addTransition(q0, q1, new CharClassTransitionLabel(WHITESPACE_CHARS));
        return automaton;
    }
View Full Code Here

    public AutomatonSpecification createFixedAutomaton() {

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();
        char a = '0';
        char b = '9';
        State q0 = automaton.addState();
        State q1 = automaton.addState();
        automaton.addTransition(q0, q1, new CharRangeTransitionLabel(a, b));
        automaton.markAsInitial(q0);
        automaton.markAsFinal(q1);

        return automaton;
View Full Code Here

    @Override
    public final AutomatonSpecification createFixedAutomaton() {
        NaiveAutomatonSpecification spec = new NaiveAutomatonSpecification();

        State q0 = spec.addState();
        spec.markAsInitial(q0);

        State q;
        for (int i = this.from; i <= this.to; ++i) {
            q = spec.addTransitionSequence(q0, Integer.toString(i));
            spec.markAsFinal(q);
        }
View Full Code Here

public class AtLeastOneOperator extends UnaryRegexpOperator {

    @Override
    public AutomatonSpecification createAutomatonFromOneAutomaton(
            AutomatonSpecification subautomaton) {
        State q = subautomaton.addState();
        List<State> listOfStates = subautomaton.allStates();
        subautomaton.markAsFinal(q);
        for (int i = 0; i < listOfStates.size(); i++) {
            if (subautomaton.isFinal(listOfStates.get(i))) {
                subautomaton.addTransition(listOfStates.get(i), q, new EpsilonTransitionLabel());
View Full Code Here

public class AnyStringOperator extends NullaryRegexpOperator {
    @Override
    public final AutomatonSpecification createFixedAutomaton() {
        NaiveAutomatonSpecification spec = new NaiveAutomatonSpecification();

        State q = spec.addState();
        spec.markAsInitial(q);
        spec.markAsFinal(q);

        spec.addTransition(q, q, new AnyTransitionLabel());
View Full Code Here

     */
    public final void testTwoStatesOneTransitionLabel() {

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

        State q0 = automaton.addState();
        State q1 = automaton.addState();
        automaton.addTransition(q0, q1, new CharTransitionLabel('a'));

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

View Full Code Here

     */
    public final void testExemplaryAutomaton() {

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

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


View Full Code Here

    public final void testThreeStatesTwoFinalStates() {

        AutomatonSpecification automaton = new NaiveAutomatonSpecification();

        State q0 = automaton.addState();
        State q1 = automaton.addState();
        State q2 = automaton.addState();
        automaton.addTransition(q0, q1, new CharTransitionLabel('a'));
        automaton.addTransition(q0, q2, new CharTransitionLabel('b'));

        automaton.markAsInitial(q0);
        automaton.markAsFinal(q1);
View Full Code Here

    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'));
View Full Code Here

TOP

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

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.