package org.parboiled.matchers.join;

import org.parboiled.Rule;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
public final class JoiningRuleBuilder
{
    private final Rule joined;
    private final Rule joining;

    JoiningRuleBuilder(final Rule joined, final Rule joining)
    {
        this.joined = joined;
        this.joining = joining;
    }
}

@@ -42,26 +42,194 @@
 ort 
-org.parboiled.Rule
+com.google.common.base.Preconditions;%0Aimport com.google.common.collect.Range;%0Aimport org.parboiled.Rule;%0Aimport org.parboiled.matchers.EmptyMatcher;%0Aimport org.parboiled.matchers.Matcher
 ;%0A%0Ai
@@ -512,24 +512,24 @@
 d = joined;%0A
-
         this
@@ -553,11 +553,1579 @@
 g;%0A    %7D
+%0A%0A    public Matcher min(final int nrMatches)%0A    %7B%0A        Preconditions.checkArgument(nrMatches %3E= 0,%0A            %22illegal repetition number specified: %22 + nrMatches%0A            + %22, must be 0 minimum%22);%0A        return new JoinMatcher(joined, joining, Range.atLeast(nrMatches));%0A    %7D%0A%0A    public Matcher max(final int nrMatches)%0A    %7B%0A        Preconditions.checkArgument(nrMatches %3E= 0,%0A            %22illegal repetition number specified: %22 + nrMatches%0A            + %22, must be 0 minimum%22);%0A        if (nrMatches == 0)%0A            return new EmptyMatcher();%0A        if (nrMatches == 1)%0A            return (Matcher) joined;%0A        return new JoinMatcher(joined, joining, Range.atMost(nrMatches));%0A    %7D%0A%0A    public Matcher times(final int nrMatches)%0A    %7B%0A        Preconditions.checkArgument(nrMatches %3E= 0,%0A            %22illegal repetition number specified: %22 + nrMatches%0A                + %22, must be 0 minimum%22);%0A        if (nrMatches == 0)%0A            return new EmptyMatcher();%0A        if (nrMatches == 1)%0A            return (Matcher) joined;%0A        return new JoinMatcher(joined, joining, Range.singleton(nrMatches));%0A    %7D%0A%0A    public Matcher times(final int min, final int max)%0A    %7B%0A        Preconditions.checkArgument(min %3E= 0,%0A            %22illegal repetition number specified: %22 + min%0A            + %22, must be 0 minimum%22);%0A        Preconditions.checkArgument(max %3E= min,%0A            %22illegal range specified: max must be greater than min%22);%0A        return max == min ? times(min)%0A            : new JoinMatcher(joined, joining, Range.closed(min, max));%0A    %7D
 %0A%7D%0A

implement min(), max(), times()