@ParametersAreNonnullByDefault @Beta public final class JoinMatcherBuilder extends Object
JoinMatcher
At this step of the build, we have both rules (the "joined" rule and the "joining" rule). The final information to feed to the matcher is the number of cycles.
The number of cycles can be bounded on the lower end and on the upper end.
The "true" building method is range(Range); all other methods
ultimately call this one to generate the result.
The real matcher generated depends on the number of cycles required (for
the notation used here, see the javadoc for Range):
EmptyMatcher;OptionalMatcher with the joined rule as a
submatcher;BoundedDownJoinMatcher;BoundedUpJoinMatcher;ExactMatchesJoinMatcher;BoundedBothJoinMatcher.JoinMatcher,
Range| Modifier and Type | Method and Description |
|---|---|
Rule |
max(int nrCycles)
Return a rule with a maximum number of cycles to run
|
Rule |
min(int nrCycles)
Return a rule with a minimum number of cycles to run
|
Rule |
range(Range<Integer> range)
Generic method to build a
JoinMatcher |
Rule |
times(int nrCycles)
Return a rule with an exact number of cycles to run
|
Rule |
times(int minCycles,
int maxCycles)
Return a rule with both lower and upper bounds on the number of cycles
|
public Rule min(int nrCycles)
nrCycles - the number of cyclesIllegalArgumentException - nrCycles is less than 0Range.atLeast(Comparable)public Rule max(int nrCycles)
nrCycles - the number of cyclesIllegalArgumentException - nrCycles is less than 0Range.atMost(Comparable)public Rule times(int nrCycles)
nrCycles - the number of cyclesIllegalArgumentException - nrCycles is less than 0Range.singleton(Comparable)public Rule times(int minCycles, int maxCycles)
Note that the range of cycles to run is closed on both ends (that is, the minimum and maximum number of cycles are inclusive).
Note also that the rule will not fail if there are more than the maximum number of cycles; it will simply stop matching if this number of cycles is reached.
minCycles - the minimum number of cyclesmaxCycles - the maximum number of cyclesIllegalArgumentException - minimum number of cycles is negative; or
maximum number of cycles is less than the minimumRange.closed(Comparable, Comparable)@Cached public Rule range(@Nonnull Range<Integer> range)
JoinMatcher
You can use this method directly; note however that the range you will
pass as an argument will be intersected
with Range.atLeast(0); if the result of the intersection is an
empty range, this is an error condition.
Ranges which are open on any end will be turned
to closed range using Range.canonical(DiscreteDomain).
range - the range (must not be null)IllegalArgumentException - see descriptionRange.canonical(DiscreteDomain)