Esempio n. 1
0
        public static NFA CreateFromInput(char input)
        {
            AutomataStatus start = new AutomataStatus();
            AutomataStatus end   = new AutomataStatus();

            start.AddTransition(input, end);

            NFA nfa = new NFA();

            nfa.startStatus_ = start;
            nfa.endStatus_   = end;

            return(nfa);
        }
Esempio n. 2
0
        public static NFA PlusNFA(NFA op)
        {
            AutomataStatus start = new AutomataStatus();
            AutomataStatus end   = new AutomataStatus();

            start.AddTransition((char)0, op.startStatus_);
            op.endStatus_.AddTransition((char)0, end);
            op.endStatus_.AddTransition((char)0, op.startStatus_);

            NFA nfa = new NFA();

            nfa.startStatus_ = start;
            nfa.endStatus_   = end;
            return(nfa);
        }
Esempio n. 3
0
        public void AddTransition(char cInputAscii, AutomataStatus targetStatus)
        {
            // Get the target status list for cInputAscii.
            List <AutomataStatus> list;

            if (m_mapInputTargetStatus.ContainsKey(cInputAscii))
            {
                list = m_mapInputTargetStatus[cInputAscii];
            }
            else
            {
                list = new List <AutomataStatus>();
                m_mapInputTargetStatus.Add(cInputAscii, list);
            }

            list.Add(targetStatus);
        }