public void addTransition(T t1, T t2, bool isDefault = false) { transitions.Add(getState(t1), getState(t2)); if (isDefault) { if (defaultTransitions.ContainsFirst(getState(t1))) { throw new Nb_Exception("This state has already a default transition: " + defaultTransitions.FindAllSeconds(getState(t1))[0]); } defaultTransitions.Add(getState(t1), getState(t2)); } }
public Nb_Tuple <T1, T2> FindAllSeconds(T1 first) { Nb_Tuple <T1, T2> res = new Nb_Tuple <T1, T2> (); foreach (Nb_TupleItem <T1, T2> item in items) { if (item.getFirst().Equals(first)) { res.Add(item.getFirst(), item.getSecond()); } } return(res); }