comparison Implab/Automaton/RegularExpressions/RegularDFADefinition.cs @ 169:54270c2f29f2 ref20160224

DFA refactoring
author cin
date Thu, 03 Mar 2016 08:41:02 +0300
parents e227e78d72e4
children 181119ef3b39
comparison
equal deleted inserted replaced
168:8fb9c9507a26 169:54270c2f29f2
1 using System; 1 using System;
2 2
3 namespace Implab.Automaton.RegularExpressions { 3 namespace Implab.Automaton.RegularExpressions {
4 public class RegularDFADefinition<TInput, TTag> : DFATransitionTable<TTag>, IDFATransitionTable<TTag> { 4 public class RegularDFADefinition<TInput, TTag> : DFATable {
5 5
6 readonly IAlphabet<TInput> m_alphabet; 6 readonly IAlphabet<TInput> m_alphabet;
7 7
8 public RegularDFADefinition(IAlphabet<TInput> alphabet) { 8 public RegularDFADefinition(IAlphabet<TInput> alphabet) {
9 Safe.ArgumentNotNull(alphabet, "aplhabet"); 9 Safe.ArgumentNotNull(alphabet, "aplhabet");
16 get { 16 get {
17 return m_alphabet; 17 return m_alphabet;
18 } 18 }
19 } 19 }
20 20
21 protected override DFAStateDescriptior<TTag>[] ConstructTransitionTable() { 21 protected override DFAStateDescriptior[] ConstructTransitionTable() {
22 if (InputAlphabet.Count != m_alphabet.Count) 22 if (InputAlphabet.Count != m_alphabet.Count)
23 throw new InvalidOperationException("The alphabet doesn't match the transition table"); 23 throw new InvalidOperationException("The alphabet doesn't match the transition table");
24 24
25 return base.ConstructTransitionTable(); 25 return base.ConstructTransitionTable();
26 } 26 }