Ejemplo n.º 1
0
        //For a set of states
        public SortedSet <String> findMultipleAccessible(Automata <String> Automata, char letter, SortedSet <String> states)
        {
            SortedSet <String> foundStates = new SortedSet <String>();

            foreach (var state in states)
            {
                foreach (var item in Automata.getToStates(state, letter))
                {
                    if (!foundStates.Contains(item))
                    {
                        foundStates.Add(item);
                    }
                }
            }
            return(foundStates);
        }
Ejemplo n.º 2
0
        public Automata <String> NDFAToDFA(Automata <String> Automata)
        {
            SortedSet <char>  alphabet = Automata.getAlphabet();
            Automata <String> dfa      = new Automata <String>(alphabet);

            foreach (String state in Automata.getStates())
            {
                foreach (var letter in alphabet)
                {
                    foreach (var item in Automata.getToStates(state, letter))
                    {
                        Console.WriteLine("State: " + state + " met Letter: " + letter + " kan ik hier komen: " + item);
                    }
                }
            }
            return(dfa);
        }
Ejemplo n.º 3
0
        //For a single state

        public SortedSet <String> findStartState(Automata <String> Automata)
        {
            SortedSet <String> foundStates = new SortedSet <String>();

            foreach (var start in Automata.getStartStates())
            {
                foundStates.Add(start);
                foreach (var item in Automata.getToStates(start, '$'))
                {
                    if (!foundStates.Contains(item))
                    {
                        foundStates.Add(item);
                    }
                }
            }
            return(foundStates);
        }