diff Implab/Automaton/DFATable.cs @ 180:c32688129f14 ref20160224

refactoring complete, JSONParser rewritten
author cin
date Thu, 24 Mar 2016 02:30:46 +0300
parents d5c5db0335ee
children b2b6a6640aa3
line wrap: on
line diff
--- a/Implab/Automaton/DFATable.cs	Wed Mar 23 19:52:08 2016 +0300
+++ b/Implab/Automaton/DFATable.cs	Thu Mar 24 02:30:46 2016 +0300
@@ -77,7 +77,7 @@
         }
 
         public bool Remove(AutomatonTransition item) {
-            m_transitions.Remove(item);
+            return m_transitions.Remove(item);
         }
 
         public int Count {
@@ -168,9 +168,9 @@
 
             var rmap = m_transitions
                 .GroupBy(t => t.s2)
-                .ToLookup(
+                .ToDictionary(
                     g => g.Key, // s2
-                    g => g.ToLookup(t => t.edge, t => t.s1)
+                    g => g.GroupBy(t => t.edge, t => t.s1).ToDictionary(p => p.Key)
                 );
 
             while (queue.Count > 0) {
@@ -180,7 +180,7 @@
                 for (int c = 0; c < m_symbolCount; c++) {
                     var stateX = new HashSet<int>();
                     foreach(var a in stateA)
-                        stateX.UnionWith(rmap[a][c]); // all states from wich 'c' leads to 'a'
+                        stateX.UnionWith(rmap[a][c]); // all states from wich the symbol 'c' leads to the state 'a'
 
                     foreach (var stateY in optimalStates.ToArray()) {
                         if (stateX.Overlaps(stateY) && !stateY.IsSubsetOf(stateX)) {