/// <summary> /// Retorna a lista de estados com transição no parâmetro value alcançáveis direta e indiretamente pelo estado /// </summary> /// <param name="value"></param> /// <returns></returns> private List <State <T, E> > ReachableStatesBy(E value, E nullSymbol, List <State <T, E> > reachableStates) { foreach (StateTransiction <T, E> transiction in Transictions) { if (transiction.Transiction.Equals(value)) { reachableStates.Add(transiction.NextState); } else { if (transiction.Transiction.Equals(nullSymbol)) { State <T, E> nextState = transiction.NextState; //Para evitar recursão if (!StateValue.Equals(nextState.StateValue)) { List <State <T, E> > auxList = nextState.ReachableStatesBy(value, nullSymbol); if (auxList != null) { reachableStates.AddRange(auxList); } } } } } if (reachableStates.Count == 0) { return(null); } else { return(reachableStates); } }
/// <summary> /// Equalses the specified s. /// </summary> /// <param name="s">The s is the compared state.</param> /// <returns> boolean if s is equal to this state. </returns> public bool Equals(State <S, C> s) { return(StateValue.Equals(s.StateValue)); }