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

    https://github.com/apache/flink/pull/2367#discussion_r75496232
  
    --- Diff: 
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java
 ---
    @@ -129,6 +141,23 @@ public Time getWindowTime() {
        }
     
        /**
    +    * Set a matching behaviour that defines if the same event can be used 
in multiple matching sequences.
    +    *
    +    * @param matchingBehaviour New matching behaviour
    +    * @return The same pattern operator with the specified matching 
behaviour
    +    */
    +   public Pattern<T, F> matchingBehaviour(MatchingBehaviour 
matchingBehaviour) {
    +
    +           Pattern<T, F> pattern = this;
    +           while (pattern != null) {
    +                   pattern.matchingBehaviour = matchingBehaviour;
    +                   pattern = (Pattern<T, F>) pattern.getPrevious();
    +           }
    +
    +           return this;
    --- End diff --
    
    Looking at the necessary implementation to wire the matching behaviour 
through all `Pattern` instances, I wonder whether the `MatchingBehaviour` 
should rather be given to the `CEP.pattern` call. There it could be given to 
the generated `NFA` which is responsible for making sure that the behaviour is 
respected. The API would then look like:
    
    `CEP.pattern(input, pattern, matchingBehaviour)`
    
    What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to