상속: Microsoft.Automata.IDeterministicFiniteTransducer
예제 #1
0
        public static IEnumerable <char> Transduce(IEnumerable <char> input)
        {
            var encoder = new DecodeDigitPairs();
            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("DecodeDigitPairs");
            }
        }
예제 #2
0
 public static IEnumerable<char> Transduce(IEnumerable<char> input)
 {
     var encoder = new DecodeDigitPairs();
     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("DecodeDigitPairs");
 }