public Transition(Event e, StateBase from, StateBase to) { Event = e; Evt = e.BaseName; FromState = from; ToState = to; }
public List<int> ToState; //0 for false; 1 for true; 2 for remaining; public EncodedTranstion(string eventName, List<int> fromState, List<int> toState, StateBase fromName, StateBase toName) { this.FromState = fromState; this.ToState = toState; this.fromName = fromName; this.toName = toName; Event = eventName; }
public AutomatonBase(string name, List<string> vars, List<StateBase> states, List<StateBase> fromSt, List<StateBase> toSt) { Name = name; InitialState = states[0]; InitialState.IsInitial = true; States = states; Parameters = vars; EventList = new List<string>(); StateNumber = states.Count; TransitionNumber = 0; IsProperty = false; Transitions = new List<Transition>(); fromState = fromSt; toState = toSt; }
public AutomatonBase Clone() { var stateList = new List<StateBase>(); var newInitState = new StateBase(InitialState.Name, InitialState.ID, InitialState.IsInitial, InitialState.IsAccepted ); stateList.Add(newInitState); var clonedAutomaton = new AutomatonBase(Name + "_d_", null, stateList, new List<StateBase>(), new List<StateBase>()); var stateDic = new Dictionary<StateBase, StateBase>(); stateDic.Add(InitialState, newInitState); foreach (StateBase oState in States) { if (oState.IsInitial) { continue; } var nState = new StateBase(oState.Name, oState.Name, oState.IsInitial, oState.IsAccepted); clonedAutomaton.States.Add(nState); stateDic.Add(oState, nState); } foreach (StateBase state in States) { foreach (Transition oldOTran in state.OutgoingTransitions) { StateBase nSource = null; StateBase nDestination = null; nSource = stateDic[oldOTran.FromState]; nDestination = stateDic[oldOTran.ToState]; var newOTran = new Transition(oldOTran.Event, nSource, nDestination); nSource.OutgoingTransitions.Add(newOTran); } } foreach (string evt in EventList) { clonedAutomaton.EventList.Add(evt); } return clonedAutomaton; }