using System; namespace Implab.Automaton.RegularExpressions { public class RegularDFADefinition : DFATransitionTable, IDFATransitionTable { readonly IAlphabet m_alphabet; public RegularDFADefinition(IAlphabet alphabet) { Safe.ArgumentNotNull(alphabet, "aplhabet"); m_alphabet = alphabet; } public IAlphabet InputAlphabet { get { return m_alphabet; } } protected override DFAStateDescriptior[] ConstructTransitionTable() { if (InputAlphabet.Count != m_alphabet.Count) throw new InvalidOperationException("The alphabet doesn't match the transition table"); return base.ConstructTransitionTable(); } /// /// Optimize the specified alphabet. /// /// /// Пустой алфавит, который будет зполнен в процессе оптимизации. public void Optimize(IDFATableBuilder dfaTable, IAlphabetBuilder alphabet) { Safe.ArgumentNotNull(alphabet, "alphabet"); Safe.ArgumentNotNull(dfaTable, "dfaTable"); Optimize(dfaTable, InputAlphabet, alphabet, new DummyAlphabet(StateCount), new MapAlphabet()); } } }