Delta() public method

public Delta ( int state, int c ) : int
state int
c int
return int
コード例 #1
0
ファイル: UTF8EncodeFlat.cs プロジェクト: teodorov/Automata-1
        public static IEnumerable <char> Transduce(IEnumerable <char> input)
        {
            var encoder = new UTF8Encoder();
            int state   = encoder.q0;

            foreach (char c in input)
            {
                foreach (char d in encoder.Psi(state, (int)c))
                {
                    yield return(d);
                }
                state = encoder.Delta(state, (int)c);
            }
            if (encoder.F.Contains(state))
            {
                foreach (char d in encoder.Psi(state, -1))
                {
                    yield return(d);
                }
            }
            else
            {
                throw new Exception("UTF8Encoder");
            }
        }
コード例 #2
0
 public static IEnumerable<char> Transduce(IEnumerable<char> input)
 {
     var encoder = new UTF8Encoder();
     int state = encoder.q0;
     foreach (char c in input)
     {
       foreach (char d in encoder.Psi(state, (int)c))
     yield return d;
       state = encoder.Delta(state, (int)c);
     }
     if (encoder.F.Contains(state))
     {
       foreach (char d in encoder.Psi(state, -1))
     yield return d;
     }
     else
       throw new Exception("UTF8Encoder");
 }