diff Implab/Automaton/RegularExpressions/RegularDFADefinition.cs @ 165:e227e78d72e4 ref20160224

DFA refactoring
author cin
date Mon, 29 Feb 2016 02:02:17 +0300
parents ec35731ae299
children 54270c2f29f2
line wrap: on
line diff
--- a/Implab/Automaton/RegularExpressions/RegularDFADefinition.cs	Thu Feb 25 02:11:13 2016 +0300
+++ b/Implab/Automaton/RegularExpressions/RegularDFADefinition.cs	Mon Feb 29 02:02:17 2016 +0300
@@ -4,13 +4,11 @@
     public class RegularDFADefinition<TInput, TTag> : DFATransitionTable<TTag>, IDFATransitionTable<TTag> {
 
         readonly IAlphabet<TInput> m_alphabet;
-        readonly int m_initialState;
 
-        public RegularDFADefinition(IAlphabet<TInput> alphabet, int initialState) {
+        public RegularDFADefinition(IAlphabet<TInput> alphabet) {
             Safe.ArgumentNotNull(alphabet, "aplhabet");
 
             m_alphabet = alphabet;
-            m_initialState = initialState;
         }
 
 
@@ -30,14 +28,13 @@
         /// <summary>
         /// Optimize the specified alphabet.
         /// </summary>
+        /// <param name = "dfaTable"></param>
         /// <param name="alphabet">Пустой алфавит, который будет зполнен в процессе оптимизации.</param>
-        public  RegularDFADefinition<TInput, TTag> Optimize(IAlphabetBuilder<TInput> alphabet) {
+        public void Optimize(IDFATableBuilder<TTag> dfaTable, IAlphabetBuilder<TInput> alphabet) {
             Safe.ArgumentNotNull(alphabet, "alphabet");
+            Safe.ArgumentNotNull(dfaTable, "dfaTable");
 
-            var optimalDFA = new RegularDFADefinition<TInput,TTag>(alphabet, m_initialState);
-
-            Optimize(optimalDFA, InputAlphabet, alphabet, new DummyAlphabet(StateCount), new MapAlphabet<int>()); 
-
+            Optimize(dfaTable, InputAlphabet, alphabet, new DummyAlphabet(StateCount), new MapAlphabet<int>()); 
         }