FormeleMethode/Automata.cs
/// <summary>
/// Returns a list with states that can be reached from given state via epsilons
/// </summary>
/// <param name="state">The state.</param>
/// <returns></returns>
Returns a list with states that can be reached from given state via epsilons
Returns a list with states that can be reached from given state via epsilons
public List<T> EClosure(T state)
		{
			List<T> reachableStates = new List<T>();
			foreach (Transition<T> trans in transitions)
			{
				if(trans.GetFromState().Equals(state))
				{
					if (trans.GetSymbol() == '$')
					{
						reachableStates.Add(trans.GetFromState());
						reachableStates.Add(trans.GetToState());
						reachableStates.AddRange(EClosure(trans.GetToState()));
					}
					else 
					{
						reachableStates.Add(trans.GetFromState()); 
					}
				}
			}
			return reachableStates.Distinct().ToList();
		}
public List < T > EClosure ( T state ) { List < T > reachableStates = new List < T > ( ) ; foreach ( Transition < T > trans in transitions ) { if ( trans . GetFromState ( ) . Equals ( state ) ) { if ( trans . GetSymbol ( ) == ' ' ) { reachableStates . Add ( trans . GetFromState ( ) ) ; reachableStates . Add ( trans . GetToState ( ) ) ; reachableStates . AddRange ( EClosure ( trans . GetToState ( ) ) ) ; } else { reachableStates . Add ( trans . GetFromState ( ) ) ; } } } return reachableStates . Distinct ( ) . ToList ( ) ; }
Returns a list with states that can be reached from given state via epsilons
Returns a list with states that can be reached from given state via epsilons
// Loop through transitions untill transition.from == state // If we found a transition with fromstate == state // If epsilon add ToState to list and look for all children // Else add fromstate since its the last node // TODO we should look further 
None
state
T
None