public RegexState(State state) : base(state.name, isInit: state.isInit) { if (UnitedFinal == null && finalInMade == false) { finalInMade = true; UnitedFinal = new RegexState(new State("FinalState")); UnitedFinal.isFinal = true; } this.backTransitions = state.backTransitions; this.DTransitions = state.DTransitions; this.selfRegex = ""; if (state.isFinal)//add a lambda expression to final state { this.AddTransition("", RegexState.UnitedFinal); } FindSelfLoops(); if (this.isInit == true) { RegexState.initial = this; } if (state.name != "FinalState") { RegexState.AllStates.Add(this); } }
public string findRegExp() { RegexState.Regex = ""; foreach (var s in this.States) { new RegexState(s); } RegexState.DeleteStates(); string reg = RegexState.Regex; RegexState.Reset(); return(reg); }