Example #1
0
 /// <summary>
 /// Register the list of edges with a list of tuples containing the tags of the initial and final state
 /// as well as the tag for the edge to create.
 /// </summary>
 /// <param name="nfa">The finite state automaton to which the edges must be added.</param>
 /// <param name="edges">A <see cref="T:IEnumerable`1"/> of <see cref="T:Tuple`3"/> instance containing
 /// the tag of the initial state, the tag of the edge to create and the tag of the final state.</param>
 /// <remarks>
 /// <para>If there is no state associated with the <paramref name="fromStateTag"/> or <paramref name="toStateTag"/>,
 /// states are registered (using the <see cref="M:RegisterState"/> method) for these tags.</para>
 /// <para>If there already exists an edge between the two given states with the given tag, no additional
 /// edge is registered.</para>
 /// <para>If the given list of <paramref name="edges"/> or the <paramref name="nfa"/> is not effective, nothing happens.</para>
 /// <para>This operation is not completely specific to the given automaton: if the state is shared with another
 /// automaton, the edge will be added to all the automata.</para>
 /// </remarks>
 public static void RegisterEdges <TStateTag, TEdgeTag> (this INondeterministicFiniteAutomaton <TStateTag, TEdgeTag> nfa, IEnumerable <Tuple <TStateTag, TEdgeTag, TStateTag> > edges)
 {
     if (edges != null && nfa != null)
     {
         foreach (Tuple <TStateTag, TEdgeTag, TStateTag> edge in edges)
         {
             nfa.RegisterEdge(edge.Item1, edge.Item2, edge.Item3);
         }
     }
 }