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

Examples of pl.edu.amu.wmi.daut.base.NaiveAutomatonSpecification$NaiveState


    @Override
    public AutomatonSpecification createAutomatonFromTwoAutomata(
            AutomatonSpecification leftSubautomaton, AutomatonSpecification rightSubautomaton) {

        AutomatonSpecification automatonLR = new NaiveAutomatonSpecification();
        AutomatonSpecification automatonRL = new NaiveAutomatonSpecification();

        concatenate(leftSubautomaton, rightSubautomaton, automatonLR);
        concatenate(rightSubautomaton, leftSubautomaton, automatonRL);

        return AutomataOperations.sum(automatonLR, automatonRL);
View Full Code Here


    public void setCharacter(char c) {
        this.character = c;
    }
    @Override
    public AutomatonSpecification createFixedAutomaton() {
        return new NaiveAutomatonSpecification().makeOneTransitionAutomaton(character);
    }
View Full Code Here

     * Generuje automat.
     */
    @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(str));

        return automaton;
    }
View Full Code Here

    * Glowna metoda klasy.
    */
    public AutomatonSpecification createAutomatonFromOneAutomaton(
            AutomatonSpecification subautomaton) {

        AutomatonSpecification finalAutomaton = new NaiveAutomatonSpecification();
        if (this.min > this.max) {
            return finalAutomaton;
        } else {
            finalAutomaton = subautomaton.clone();
            if (this.min == 0) {
                finalAutomaton.markAsFinal(finalAutomaton.getInitialState());
                if (this.max == 0) {
                    for (State state : finalAutomaton.allStates()) {
                        finalAutomaton.unmarkAsFinalState(state);
                    }
                    finalAutomaton.markAsFinal(finalAutomaton.getInitialState());
                }
            }

            for (int i = 1; i < this.max; i++) {
                State newState = finalAutomaton.addState();

                for (State state : finalAutomaton.allStates()) {
                    if (finalAutomaton.isFinal(state)) {
                        finalAutomaton.addTransition(state, newState, new EpsilonTransitionLabel());
                        if (i < this.min)
                            finalAutomaton.unmarkAsFinalState(state);
                    }
                }
                finalAutomaton.insert(newState, subautomaton);
            }
        }
        return finalAutomaton;
    }
View Full Code Here

     * Główna metoda klasy.
     */
    public AutomatonSpecification createAutomatonFromOneAutomaton(
            AutomatonSpecification subautomaton) {

        AutomatonSpecification automatbudowany = new NaiveAutomatonSpecification();

        if (numberOfOccurrences == 0) {
            State state = automatbudowany.addState();
            automatbudowany.markAsInitial(state);
            automatbudowany.markAsFinal(state);
        }

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

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

    }
/**
  * Metoda budująca automat.
  */
        public AutomatonSpecification createFixedAutomaton() {
        return new
             NaiveAutomatonSpecification().makeOneTransitionAutomaton('\13');
    }
View Full Code Here

     * Generuje automat.
     */
    @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(str));

        return automaton;
    }
View Full Code Here

     * Glowna metoda klasy.
     */
    public AutomatonSpecification createAutomatonFromOneAutomaton(
            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());
                }
            }
        }
        return newAutomaton;
    }
View Full Code Here

    private char znak;

    @Override
    public AutomatonSpecification createFixedAutomaton() {
        return new NaiveAutomatonSpecification().makeOneTransitionAutomaton(translate());
    }
View Full Code Here

public class NoDigitOperator extends NullaryRegexpOperator {
    /**
     * Główna metoda klasy.
     */
    public AutomatonSpecification createFixedAutomaton() {
        AutomatonSpecification noDigitAutomaton = new NaiveAutomatonSpecification();
        State state1 = noDigitAutomaton.addState();
        State state2 = noDigitAutomaton.addState();
        noDigitAutomaton.addTransition(state1, state2,
                new ComplementCharClassTransitionLabel("0-9"));
        noDigitAutomaton.markAsInitial(state1);
        noDigitAutomaton.markAsFinal(state2);
        return noDigitAutomaton;
    }
View Full Code Here

TOP

Related Classes of pl.edu.amu.wmi.daut.base.NaiveAutomatonSpecification$NaiveState

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.