diff Implab/Automaton/RegularExpressions/RegularDFA.cs @ 183:4f82e0f161c3 ref20160224

fixed DFA optimization, JSON is fully functional
author cin
date Fri, 25 Mar 2016 02:49:02 +0300
parents 76e8f2ba12b8
children fa6cbf4d8841
line wrap: on
line diff
--- a/Implab/Automaton/RegularExpressions/RegularDFA.cs	Thu Mar 24 18:52:10 2016 +0300
+++ b/Implab/Automaton/RegularExpressions/RegularDFA.cs	Fri Mar 25 02:49:02 2016 +0300
@@ -66,19 +66,15 @@
             // skip all unclassified symbols
             foreach (var pair in alphaMap.Where(x => x.Value != 0))
                 alphabet.DefineClass(m_alphabet.GetSymbols(pair.Key), pair.Value);
-
-            var orig = ToString();
-            var opt = dfa.ToString();
-            
             return dfa;
         }
 
-        protected override IEnumerable<HashSet<int>> GroupFinalStates() {
+        protected override IEnumerable<HashSet<int>> SplitFinalStates(IEnumerable<int> states) {
             var arrayComparer = new CustomEqualityComparer<TTag[]>(
                 (x,y) => x.Length == y.Length && x.All(it => y.Contains(it)),
                 x => x.Sum(it => x.GetHashCode())
             );
-            return FinalStates.GroupBy(x => m_tags[x], arrayComparer).Select(g => new HashSet<int>(g));
+            return states.GroupBy(x => m_tags[x] ?? new TTag[0], arrayComparer).Select(g => new HashSet<int>(g));
         }
 
         public override string ToString() {