/// <summary>
        /// 递归获取指定转换开始能经到的所有转换的集合。
        /// </summary>
        /// <param name="transition">指定的转换。</param>
        /// <returns>指定转换开始能经到的所有转换的集合。</returns>
        /// <exception cref="ArgumentNullException"><paramref name="transition"/> 的值为 null 。</exception>
        public static IEnumerable <IRegexFSMTransition <T> > RecurGetTransitions <T>(this IRegexFSMTransition <T> transition)
        {
            if (transition == null)
            {
                throw new ArgumentNullException(nameof(transition));
            }

            HashSet <IRegexFSMTransition <T> > transitions = new HashSet <IRegexFSMTransition <T> >();

            RegexFSMUtility.RecurGetTransitionsInternal(transition, transitions);

            return(transitions);
        }
 private static void RecurGetTransitionsInternal <T>(IRegexFSMTransition <T> transition, HashSet <IRegexFSMTransition <T> > transitions)
 {
     if (transitions.Add(transition))
     {
         if (transition.Target != null)
         {
             foreach (var _transition in transition.Target.Transitions.Where(t => t != null))
             {
                 RegexFSMUtility.RecurGetTransitionsInternal(_transition, transitions);
             }
         }
     }
 }