comparison Implab/Automaton/RegularExpressions/RegularDFA.cs @ 179:478ef706906a ref20160224

sync
author cin
date Wed, 23 Mar 2016 19:52:08 +0300
parents d5c5db0335ee
children c32688129f14
comparison
equal deleted inserted replaced
178:d5c5db0335ee 179:478ef706906a
1 using System.Collections.Generic; 1 using System.Collections.Generic;
2 using System.Linq; 2 using System.Linq;
3 3
4 namespace Implab.Automaton.RegularExpressions { 4 namespace Implab.Automaton.RegularExpressions {
5 public class TaggedDFA<TInput, TTag> : DFATable, ITaggedDFABuilder<TTag> { 5 public class RegularDFA<TInput, TTag> : DFATable, ITaggedDFABuilder<TTag> {
6 6
7 readonly Dictionary<int,TTag[]> m_tags = new Dictionary<int, TTag[]>(); 7 readonly Dictionary<int,TTag[]> m_tags = new Dictionary<int, TTag[]>();
8 readonly IAlphabet<TInput> m_alphabet; 8 readonly IAlphabet<TInput> m_alphabet;
9 9
10 public TaggedDFA(IAlphabet<TInput> alphabet) { 10 public RegularDFA(IAlphabet<TInput> alphabet) {
11 Safe.ArgumentNotNull(alphabet, "aplhabet"); 11 Safe.ArgumentNotNull(alphabet, "aplhabet");
12 12
13 m_alphabet = alphabet; 13 m_alphabet = alphabet;
14 } 14 }
15 15
46 46
47 /// <summary> 47 /// <summary>
48 /// Optimize the specified alphabet. 48 /// Optimize the specified alphabet.
49 /// </summary> 49 /// </summary>
50 /// <param name="alphabet">Пустой алфавит, который будет зполнен в процессе оптимизации.</param> 50 /// <param name="alphabet">Пустой алфавит, который будет зполнен в процессе оптимизации.</param>
51 public TaggedDFA<TInput,TTag> Optimize(IAlphabetBuilder<TInput> alphabet) { 51 public RegularDFA<TInput,TTag> Optimize(IAlphabetBuilder<TInput> alphabet) {
52 Safe.ArgumentNotNull(alphabet, "alphabet"); 52 Safe.ArgumentNotNull(alphabet, "alphabet");
53 53
54 var dfa = new TaggedDFA<TInput, TTag>(alphabet); 54 var dfa = new RegularDFA<TInput, TTag>(alphabet);
55 55
56 var states = new DummyAlphabet(StateCount); 56 var states = new DummyAlphabet(StateCount);
57 var alphaMap = new Dictionary<int,int>(); 57 var alphaMap = new Dictionary<int,int>();
58 var stateMap = new Dictionary<int,int>(); 58 var stateMap = new Dictionary<int,int>();
59 59