Repeat() public static method

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.
return Fare.Automaton
コード例 #1
0
ファイル: BasicOperations.cs プロジェクト: AltaModaTech/Fare
        /// <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
ファイル: Automaton.cs プロジェクト: zvirja/Fare
 public Automaton Repeat(int min)
 {
     return(BasicOperations.Repeat(this, min));
 }
コード例 #3
0
ファイル: Automaton.cs プロジェクト: zvirja/Fare
 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));
 }