[ 
https://issues.apache.org/jira/browse/FLINK-6904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16053542#comment-16053542
 ] 

ASF GitHub Bot commented on FLINK-6904:
---------------------------------------

Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4121#discussion_r122633648
  
    --- Diff: 
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java
 ---
    @@ -318,7 +319,30 @@ public Quantifier getQuantifier() {
                checkIfQuantifierApplied();
                Preconditions.checkArgument(times > 0, "You should give a 
positive number greater than 0.");
                this.quantifier = 
Quantifier.times(quantifier.getConsumingStrategy());
    -           this.times = times;
    +           this.times = Times.of(times);
    +           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();
    +           Preconditions.checkArgument(from >= 0, "The from should be a 
non-negative number greater than or equal to 0.");
    --- End diff --
    
    It is already checked in `Times` class. Maybe remove those checks from here?


> Support for quantifier range to CEP's pattern API
> -------------------------------------------------
>
>                 Key: FLINK-6904
>                 URL: https://issues.apache.org/jira/browse/FLINK-6904
>             Project: Flink
>          Issue Type: Sub-task
>          Components: CEP
>            Reporter: Dian Fu
>            Assignee: Dian Fu
>
> Currently the quantifier has supported oneOrMore, times(int times), one(),we 
> should also support API such as times(int from, int to) to specify a 
> quantifier range.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to