Пример #1
0
        public void move(Dfa dfa, int b)
        {
            List <Nfa> nFASet = dfa.GetNFASet();

            this.nfa_set = null;
            this.nfa_bit = null;
            int count = nFASet.Count;

            for (int i = 0; i < count; i++)
            {
                Nfa nfa = nFASet[i];
                if (b == (int)nfa.Edge || ('￾' == nfa.Edge && nfa.GetCharSet().contains(b)))
                {
                    if (this.nfa_set == null)
                    {
                        this.nfa_set = new List <Nfa>();
                        this.nfa_bit = new BitSet();
                    }
                    this.nfa_set.Add(nfa.Next);
                    this.nfa_bit.Set(nfa.Next.Label, true);
                }
            }
            if (this.nfa_set != null)
            {
                this.sort_states();
            }
        }
Пример #2
0
/*
 * Function: move
 */
        public void move(Dfa dfa, int b)
        {
            int       size;
            Nfa       state;
            ArrayList old_set = dfa.GetNFASet();

            nfa_set = null;
            nfa_bit = null;

            size = old_set.Count;
            for (int index = 0; index < size; index++)
            {
                state = (Nfa)old_set[index];

                if (b == state.GetEdge() ||
                    (Nfa.CCL == state.GetEdge() && state.GetCharSet().contains(b)))
                {
                    if (nfa_set == null)
                    {
                        nfa_set = new ArrayList();
                        nfa_bit = new BitSet();
                    }
                    nfa_set.Add(state.GetNext());
#if OLD_DEBUG
                    Console.WriteLine("Size of bitset: " + int.ToString(nfa_bit.GetLength()));
                    Console.WriteLine("Reference index: " + int.ToString(state.GetNext().GetLabel()));
#endif
                    nfa_bit.Set(state.GetNext().GetLabel(), true);
                }
            }

            if (nfa_set != null)
            {
#if DEBUG
                Utility.assert(null != nfa_bit);
#endif
                sort_states();
            }
            return;
        }