src/main/java/de/dfki/lt/loot/fsa/FiniteAutomaton.java
public SubAutomaton repeat(SubAutomaton sub, int min, int max) {

    if (min > max) {
      min = max;
    }

    max = max - min;

    // create concatenation of min automatons (non-optional)
    SubAutomaton currentAut;
    if (min == 0) {
      currentAut = new SubAutomaton();
    }
    else if (min == 1) {
      currentAut = sub.copy();
    }
    else {
      List<SubAutomaton> minSubs = new ArrayList<SubAutomaton>();
      while (min > 0) {
        minSubs.add(sub.copy());
        min--;
      }
      currentAut = multiConcatenate(minSubs);
    }

    // add concatenation of max automatons (optional);
    // optional: add epsilon edges from initial state to all final states
    if (max > 0) {
      List<SubAutomaton> maxSubs = new ArrayList<SubAutomaton>();
      while (max > 0) {
        SubAutomaton maxSub = sub.copy();
        newEdge(EPSILON, maxSub.getInitialState(), maxSub.getFinalState());
        maxSubs.add(maxSub);
        max--;
      }
      SubAutomaton maxSubsConcatenated = multiConcatenate(maxSubs);
      currentAut = concatenate(currentAut, maxSubsConcatenated);
    }

    return currentAut;
  }
/**
   * Returns a subautomaton that accepts between {@code min} and {@code max}
   * (including both) concatenated repetitions of the language of the given
   * automaton.
   *
   * @param sub
   *          the subautomaton
   * @param min
   *          the minimum repetition
   * @param max
   *          the maximum repetition
   * @return the result subautomaton
   */
Returns a subautomaton that accepts between  min and  max
(including both) concatenated repetitions of the language of the given
automaton.

@param sub
the subautomaton
@param min
the minimum repetition
@param max
the maximum repetition
@return the result subautomaton
Returns a subautomaton that accepts between min and max ( including both ) concatenated repetitions of the language of the given automaton . @param sub the subautomaton @param min the minimum repetition @param max the maximum repetition @return the result subautomaton
public SubAutomaton repeat(SubAutomaton sub, int min, int max) {
    if (min > max) {
      min = max;
    }
    max = max - min;
    SubAutomaton currentAut;
    if (min == 0) {
      currentAut = new SubAutomaton();
    }
    else if (min == 1) {
      currentAut = sub.copy();
    }
    else {
      List<SubAutomaton> minSubs = new ArrayList<SubAutomaton>();
      while (min > 0) {
        minSubs.add(sub.copy());
        min--;
      }
      currentAut = multiConcatenate(minSubs);
    }
    if (max > 0) {
      List<SubAutomaton> maxSubs = new ArrayList<SubAutomaton>();
      while (max > 0) {
        SubAutomaton maxSub = sub.copy();
        newEdge(EPSILON, maxSub.getInitialState(), maxSub.getFinalState());
        maxSubs.add(maxSub);
        max--;
      }
      SubAutomaton maxSubsConcatenated = multiConcatenate(maxSubs);
      currentAut = concatenate(currentAut, maxSubsConcatenated);
    }
    return currentAut;
  }
public SubAutomaton repeat ( SubAutomaton sub , int min , int max ) { if ( min > max ) { min = max ; } max = max - min ; SubAutomaton currentAut ; if ( min == 0 ) { currentAut = new SubAutomaton ( ) ; } else if ( min == 1 ) { currentAut = sub . copy ( ) ; } else { List < SubAutomaton > minSubs = new ArrayList < SubAutomaton > ( ) ; while ( min > 0 ) { minSubs . add ( sub . copy ( ) ) ; min -- ; } currentAut = multiConcatenate ( minSubs ) ; } if ( max > 0 ) { List < SubAutomaton > maxSubs = new ArrayList < SubAutomaton > ( ) ; while ( max > 0 ) { SubAutomaton maxSub = sub . copy ( ) ; newEdge ( EPSILON , maxSub . getInitialState ( ) , maxSub . getFinalState ( ) ) ; maxSubs . add ( maxSub ) ; max -- ; } SubAutomaton maxSubsConcatenated = multiConcatenate ( maxSubs ) ; currentAut = concatenate ( currentAut , maxSubsConcatenated ) ; } return currentAut ; }
Returns a subautomaton that accepts between {@code min} and {@code max}
 (including both) concatenated repetitions of the language of the given
 automaton.
Returns a subautomaton that accepts between { @code min } and { @code max } ( including both ) concatenated repetitions of the language of the given automaton .
// create concatenation of min automatons (non-optional) // add concatenation of max automatons (optional); // optional: add epsilon edges from initial state to all final states