Ejemplo n.º 1
0
            private static void EnsureComplete(FA dfa)
            {
                EnsureDfa(dfa);

                foreach (var state in dfa.States)
                {
                    var all = new Integers();
                    var sum = 0;
                    foreach (var transition in state.Transitions)
                    {
                        sum += transition.Set.Cardinality;
                        all.Add(transition.Set);
                    }
                    if (!UnicodeSets.IsAny(all))
                    {
                        throw new Exception("DFA: incomplete transition set (DFA is not `complete´)");
                    }
                    if (sum != all.Cardinality)
                    {
                        throw new Exception("DFA: overlapping transitions (DFA is not `sane´)");
                    }
                }
            }