Repeat() публичный статический Метод

Accepts the Kleene star (zero or more concatenated repetitions) of the language of the given automaton. Never modifies the input automaton language.
Complexity: linear in number of states.
public static Repeat ( Fare.Automaton a ) : Fare.Automaton
a Fare.Automaton The automaton.
Результат Fare.Automaton
Пример #1
0
        /// <summary>
        /// Accepts <code>min</code> or more concatenated repetitions of the language of the given
        /// automaton.
        /// </summary>
        /// <param name="a">The automaton.</param>
        /// <param name="min">The minimum concatenated repetitions of the language of the given
        /// automaton.</param>
        /// <returns>Returns an automaton that accepts <code>min</code> or more concatenated
        /// repetitions of the language of the given automaton.
        /// </returns>
        /// <remarks>
        /// Complexity: linear in number of states and in <code>min</code>.
        /// </remarks>
        public static Automaton Repeat(Automaton a, int min)
        {
            if (min == 0)
            {
                return(BasicOperations.Repeat(a));
            }

            var @as = new List <Automaton>();

            while (min-- > 0)
            {
                @as.Add(a);
            }

            @as.Add(BasicOperations.Repeat(a));
            return(BasicOperations.Concatenate(@as));
        }
Пример #2
0
 public Automaton Repeat(int min)
 {
     return(BasicOperations.Repeat(this, min));
 }
Пример #3
0
 public Automaton Repeat()
 {
     return(BasicOperations.Repeat(this));
 }
Пример #4
0
 internal Automaton Repeat()
 {
     return(BasicOperations.Repeat(this));
 }
Пример #5
0
 internal Automaton Repeat(int min, int max)
 {
     return(BasicOperations.Repeat(this, min, max));
 }