Mercurial > pub > ImplabNet
comparison Implab/Parsing/EDFADefinition.cs @ 158:130781364799 v2
refactoring, code cleanup
| author | cin |
|---|---|
| date | Thu, 18 Feb 2016 14:34:02 +0300 |
| parents | 948c015a9011 |
| children | 5802131432e4 |
comparison
equal
deleted
inserted
replaced
| 157:948c015a9011 | 158:130781364799 |
|---|---|
| 1 using Implab; | 1 using Implab; |
| 2 using System; | 2 using System; |
| 3 | 3 |
| 4 namespace Implab.Parsing { | 4 namespace Implab.Parsing { |
| 5 public class EDFADefinition<T> : DFADefinitionBase where T : struct, IConvertible { | 5 public class EDFADefinition<T> : DFADefinition where T : struct, IConvertible { |
| 6 readonly EnumAlphabet<T> m_alphabet; | 6 readonly EnumAlphabet<T> m_alphabet; |
| 7 | 7 |
| 8 public EnumAlphabet<T> Alphabet { | 8 public EnumAlphabet<T> Alphabet { |
| 9 get { return m_alphabet; } | 9 get { return m_alphabet; } |
| 10 } | 10 } |
| 11 | 11 |
| 12 public EDFADefinition(EnumAlphabet<T> alphabet) { | 12 public EDFADefinition(EnumAlphabet<T> alphabet) : base(alphabet.Count) { |
| 13 Safe.ArgumentNotNull(alphabet, "alphabet"); | |
| 14 m_alphabet = alphabet; | 13 m_alphabet = alphabet; |
| 15 } | |
| 16 | |
| 17 public override int AlphabetSize { | |
| 18 get { return m_alphabet.Count; } | |
| 19 } | 14 } |
| 20 | 15 |
| 21 public void DefineTransition(int s1, int s2, T input) { | 16 public void DefineTransition(int s1, int s2, T input) { |
| 22 DefineTransition(s1, s2, m_alphabet.Translate(input)); | 17 DefineTransition(s1, s2, m_alphabet.Translate(input)); |
| 23 } | 18 } |
