comparison Implab/Parsing/CDFADefinition.cs @ 158:130781364799 v2

refactoring, code cleanup
author cin
date Thu, 18 Feb 2016 14:34:02 +0300
parents 97fbbf816844
children 5802131432e4
comparison
equal deleted inserted replaced
157:948c015a9011 158:130781364799
1 using Implab; 1 namespace Implab.Parsing {
2 using System; 2 public class CDFADefinition : DFADefinition {
3 using System.Collections.Generic; 3 readonly CharAlphabet m_alphabet;
4 using System.Linq;
5 using System.Text;
6 using System.Threading.Tasks;
7 4
8 namespace Implab.Parsing { 5 public CharAlphabet Alphabet {
9 public class CDFADefinition : DFADefinitionBase {
10 readonly Alphabet m_alphabet;
11
12 public Alphabet Alphabet {
13 get { return m_alphabet; } 6 get { return m_alphabet; }
14 } 7 }
15 8
16 public override int AlphabetSize { 9 public CDFADefinition(CharAlphabet alphabet): base(alphabet.Count) {
17 get { return m_alphabet.Count; }
18 }
19
20 public CDFADefinition(Alphabet alphabet): base() {
21 Safe.ArgumentNotNull(alphabet, "alphabet");
22 m_alphabet = alphabet; 10 m_alphabet = alphabet;
23 } 11 }
24 12
25 public CDFADefinition Optimize() { 13 public CDFADefinition Optimize() {
26 var optimized = new CDFADefinition(new Alphabet()); 14 var optimized = new CDFADefinition(new CharAlphabet());
27 15
28 Optimize(optimized, m_alphabet, optimized.Alphabet); 16 Optimize(optimized, m_alphabet, optimized.Alphabet);
29 return optimized; 17 return optimized;
30 } 18 }
31 19