/// <summary>
 /// Add state to finalstates
 /// </summary>
 /// <param name="state">The state</param>
 public void DefineAsFinalState(T state)
 {
     if (!DfaContainsState(state))
     {
         States.Add(state);
     }
     FinalStates.Add(state);
 }
Exemplo n.º 2
0
        public void DefineAsFinalState(T t)
        {
            if (!States.Contains(t))
            {
                States.Add(t);
            }

            FinalStates.Add(t);
        }
Exemplo n.º 3
0
 public bool AddFinalState(string stateName)
 {
     if (States.Contains(stateName) && !FinalStates.Contains(stateName))
     {
         FinalStates.Add(stateName);
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        public void AddFinalState(ail.net.parser.FsaState xi_state, ail.net.parser.Token xi_token)
        {
            ail.net.framework.Assert.NonNullReference(xi_state, "xi_state");
            ail.net.framework.Assert.NonNullReference(xi_token, "xi_token");

            if (!FinalStates.Contains(xi_state.Id))
            {
                xi_state.Token = xi_token;
                FinalStates.Add(xi_state.Id, xi_state);
            }
        }
Exemplo n.º 5
0
        private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (listBox5.SelectedIndex >= 0)
            {
                try
                {
                    var findedState = States.Find(state => state.Name == listBox5.SelectedItem.ToString());
//                    FindedState.IsFinal = true;
                    FinalStates.Add(findedState);
                    listBox6.Items.Add(listBox5.SelectedItem);
                    listBox5.Items.Remove(listBox5.SelectedItem);
                }
                catch (Exception exception)
                {
                    ConsoleWriter.Failure(exception.Message);
                }
            }
        }
Exemplo n.º 6
0
        public State <T> AddState(string name, double pertinenceInitial, double pertinenceFinal)
        {
            State <T> state = new State <T>(States.Count, name, pertinenceInitial, pertinenceFinal);

            States.Add(state);

            if (pertinenceInitial > 0)
            {
                FinalStates.Add(state);
            }

            if (pertinenceFinal > 0)
            {
                FinalStates.Add(state);
            }

            return(state);
        }
Exemplo n.º 7
0
        public DFA(char[] alphabets, List <Transition> transition, List <State> states)
        {
            this.Alphabets   = alphabets;
            this.States      = states;
            this.Transitions = transition;
            Table            = new TransitionTable();

            this.InitialState = states[0];
            this.FinalStates  = new List <State>();
            foreach (var s in States)
            {
                if (s.isFinal)
                {
                    FinalStates.Add(s);
                }
            }
            foreach (var t in Transitions)
            {
                Table.AddTransition(t.CurrentState, t.Token, t.NextState);
            }
        }
Exemplo n.º 8
0
 public void DefineAsFinalState(T state)
 {
     States.Add(state);
     FinalStates.Add(state);
 }