//public HashSet<NormalizedFAState> sub; public NormalizedFAState(FAState faState) { States = new HashSet <FAState>(); States.Add(faState); ID = null; //sub = new HashSet<NormalizedFAState>(); }
public FAState AddState() { int id = States.Count; FAState newState = new FAState(id); States.Add(id, newState); return(newState); }
public override string ToString() { StringBuilder toReturn = new StringBuilder(); foreach (KeyValuePair <int, FAState> keyValuePair in States) { FAState state = keyValuePair.Value; foreach (KeyValuePair <string, HashSet <FAState> > item in state.Post) { foreach (FAState st in item.Value) { toReturn.AppendLine(state.ToString() + "-" + item.Key + "->" + st.ToString()); } } } return(toReturn.ToString()); }
public void AddTransition(string evt, FAState target) { if (Post.ContainsKey(evt)) { Post[evt].Add(target); } else { HashSet <FAState> states = new HashSet <FAState>(); states.Add(target); Post.Add(evt, states); } if (target.Pre.ContainsKey(evt)) { target.Pre[evt].Add(target); } else { HashSet <FAState> states = new HashSet <FAState>(); states.Add(target); target.Pre.Add(evt, states); } }
/// <summary> /// Add a transition into the automata /// </summary> /// <param name="source"></param> /// <param name="evt"></param> /// <param name="target"></param> /// <returns>Whether the target is a new state</returns> public void AddTransition(FAState source, string evt, FAState target) { source.AddTransition(evt, target); }
public void SetInitialState(FAState init) { InitialState.Add(init); }