@ParametersAreNonnullByDefault @Beta public final class JoinMatcherBuilder<V> extends RangeMatcherBuilder<V>
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 RangeMatcherBuilder.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
parser, rule
Modifier and Type | Method and Description |
---|---|
protected Rule |
boundedBoth(int minCycles,
int maxCycles)
Build a rule which is expected to match a number of times between two
end points
|
protected Rule |
boundedDown(int minCycles)
Build a rule which is expected to match a minimum number of times
|
protected Rule |
boundedUp(int maxCycles)
Build a rule which is expected to match a maximum number of times
|
protected Rule |
exactly(int nrCycles)
Build a rule which is expected to match a fixed number of times
|
protected Rule boundedDown(int minCycles)
RangeMatcherBuilder
The returned matcher will attempt to match indefinitely its input until it fails. Success should be declared if and only if the number of times the matcher has succeeded is greater than, or equal to, the number of cycles given as an argument (including 0).
boundedDown
in class RangeMatcherBuilder<V>
minCycles
- the minimum number of cycles (inclusive)protected Rule boundedUp(int maxCycles)
RangeMatcherBuilder
The returned matcher will attempt to match repeatedly up to, and including, the number of cycles returned as an argument. Note that the argument will always be greater than or equal to 2.
One consequence is that this matcher always succeeds.
boundedUp
in class RangeMatcherBuilder<V>
maxCycles
- the maximum number of cycles (inclusive)protected Rule exactly(int nrCycles)
RangeMatcherBuilder
The returned matcher will attempt to match repeatedly up to, and including, the number of cycles given as an argument. Success should be declared if and only if the number of cycles matched is exactly this number.
exactly
in class RangeMatcherBuilder<V>
nrCycles
- the number of cycles (inclusive)protected Rule boundedBoth(int minCycles, int maxCycles)
RangeMatcherBuilder
The returned matcher will attempt to match repeatedly up to, and including, the maximum number of cycles specified as the second argument. Success should be declared if and only if the number of cycles performed is at least equal to the number of cycles specified as the first argument.
Note that the first argument will always be strictly greater than 0, and that the second argument will always be strictly greater than the first.
boundedBoth
in class RangeMatcherBuilder<V>
minCycles
- the minimum number of cycles (inclusive)maxCycles
- the maximum number of cycles (exclusive)