/** * Specifies that the pattern can occur between from and to times. * * @param from number of times matching event must appear at least * @param to number of times matching event must appear at most * @return The same pattern with the number of times range applied * * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> times(int from, int to) { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.times(quantifier.getConsumingStrategy()); if (from == 0) { this.quantifier.optional(); from = 1; } this.times = Times.of(from, to); return this; }
/** * Specifies that this pattern can occur {@code one or more} times. * This means at least one and at most infinite number of events can * be matched to this pattern. * * <p>If this quantifier is enabled for a * pattern {@code A.oneOrMore().followedBy(B)} and a sequence of events * {@code A1 A2 B} appears, this will generate patterns: * {@code A1 B} and {@code A1 A2 B}. See also {@link #allowCombinations()}. * * @return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied. * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> oneOrMore() { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy()); this.times = Times.of(1); return this; }
/** * Specifies that this pattern can occur {@code one or more} times. * This means at least one and at most infinite number of events can * be matched to this pattern. * * <p>If this quantifier is enabled for a * pattern {@code A.oneOrMore().followedBy(B)} and a sequence of events * {@code A1 A2 B} appears, this will generate patterns: * {@code A1 B} and {@code A1 A2 B}. See also {@link #allowCombinations()}. * * @return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied. * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> oneOrMore() { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy()); this.times = Times.of(1); return this; }
/** * Specifies that the pattern can occur between from and to times. * * @param from number of times matching event must appear at least * @param to number of times matching event must appear at most * @return The same pattern with the number of times range applied * * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> times(int from, int to) { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.times(quantifier.getConsumingStrategy()); if (from == 0) { this.quantifier.optional(); from = 1; } this.times = Times.of(from, to); return this; }
/** * Specifies exact number of times that this pattern should be matched. * * @param times number of times matching event must appear * @return The same pattern with number of times applied * * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> times(int times) { checkIfNoNotPattern(); checkIfQuantifierApplied(); Preconditions.checkArgument(times > 0, "You should give a positive number greater than 0."); this.quantifier = Quantifier.times(quantifier.getConsumingStrategy()); this.times = Times.of(times); return this; }
/** * Specifies that this pattern can occur the specified times at least. * This means at least the specified times and at most infinite number of events can * be matched to this pattern. * * @return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied. * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> timesOrMore(int times) { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy()); this.times = Times.of(times); return this; }
/** * Specifies exact number of times that this pattern should be matched. * * @param times number of times matching event must appear * @return The same pattern with number of times applied * * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> times(int times) { checkIfNoNotPattern(); checkIfQuantifierApplied(); Preconditions.checkArgument(times > 0, "You should give a positive number greater than 0."); this.quantifier = Quantifier.times(quantifier.getConsumingStrategy()); this.times = Times.of(times); return this; }
/** * Specifies that this pattern can occur the specified times at least. * This means at least the specified times and at most infinite number of events can * be matched to this pattern. * * @return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied. * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> timesOrMore(int times) { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy()); this.times = Times.of(times); return this; }
/** * Specifies that this pattern can occur {@code one or more} times. * This means at least one and at most infinite number of events can * be matched to this pattern. * * <p>If this quantifier is enabled for a * pattern {@code A.oneOrMore().followedBy(B)} and a sequence of events * {@code A1 A2 B} appears, this will generate patterns: * {@code A1 B} and {@code A1 A2 B}. See also {@link #allowCombinations()}. * * @return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied. * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> oneOrMore() { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy()); this.times = Times.of(1); return this; }
/** * Specifies that the pattern can occur between from and to times. * * @param from number of times matching event must appear at least * @param to number of times matching event must appear at most * @return The same pattern with the number of times range applied * * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> times(int from, int to) { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.times(quantifier.getConsumingStrategy()); if (from == 0) { this.quantifier.optional(); from = 1; } this.times = Times.of(from, to); return this; }
/** * Specifies exact number of times that this pattern should be matched. * * @param times number of times matching event must appear * @return The same pattern with number of times applied * * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> times(int times) { checkIfNoNotPattern(); checkIfQuantifierApplied(); Preconditions.checkArgument(times > 0, "You should give a positive number greater than 0."); this.quantifier = Quantifier.times(quantifier.getConsumingStrategy()); this.times = Times.of(times); return this; }
/** * Specifies that this pattern can occur the specified times at least. * This means at least the specified times and at most infinite number of events can * be matched to this pattern. * * @return The same pattern with a {@link Quantifier#looping(ConsumingStrategy)} quantifier applied. * @throws MalformedPatternException if the quantifier is not applicable to this pattern. */ public Pattern<T, F> timesOrMore(int times) { checkIfNoNotPattern(); checkIfQuantifierApplied(); this.quantifier = Quantifier.looping(quantifier.getConsumingStrategy()); this.times = Times.of(times); return this; }