flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-6356) Make times() eager and enable allowing combinations.
Date Wed, 26 Apr 2017 07:07:04 GMT

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

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

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

    https://github.com/apache/flink/pull/3761#discussion_r113377068
  
    --- Diff: flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Quantifier.java
---
    @@ -18,51 +18,83 @@
     package org.apache.flink.cep.pattern;
     
     import java.util.EnumSet;
    +import java.util.Objects;
     
    -public enum Quantifier {
    -	ONE,
    -	ZERO_OR_MORE_EAGER(QuantifierProperty.LOOPING, QuantifierProperty.EAGER),
    -	ZERO_OR_MORE_COMBINATIONS(QuantifierProperty.LOOPING),
    -	ZERO_OR_MORE_EAGER_STRICT(QuantifierProperty.EAGER, QuantifierProperty.STRICT, QuantifierProperty.LOOPING),
    -	ZERO_OR_MORE_COMBINATIONS_STRICT(QuantifierProperty.STRICT, QuantifierProperty.LOOPING),
    -	ONE_OR_MORE_EAGER(
    -		QuantifierProperty.LOOPING,
    -		QuantifierProperty.EAGER,
    -		QuantifierProperty.AT_LEAST_ONE),
    -	ONE_OR_MORE_EAGER_STRICT(
    -		QuantifierProperty.STRICT,
    -		QuantifierProperty.LOOPING,
    -		QuantifierProperty.EAGER,
    -		QuantifierProperty.AT_LEAST_ONE),
    -	ONE_OR_MORE_COMBINATIONS(QuantifierProperty.LOOPING, QuantifierProperty.AT_LEAST_ONE),
    -	ONE_OR_MORE_COMBINATIONS_STRICT(
    -		QuantifierProperty.STRICT,
    -		QuantifierProperty.LOOPING,
    -		QuantifierProperty.AT_LEAST_ONE),
    -	TIMES(QuantifierProperty.TIMES),
    -	TIMES_STRICT(QuantifierProperty.TIMES, QuantifierProperty.STRICT),
    -	OPTIONAL;
    +public class Quantifier {
     
     	private final EnumSet<QuantifierProperty> properties;
     
    -	Quantifier(final QuantifierProperty first, final QuantifierProperty... rest) {
    +	private Quantifier(final QuantifierProperty first, final QuantifierProperty... rest)
{
     		this.properties = EnumSet.of(first, rest);
     	}
     
    -	Quantifier() {
    -		this.properties = EnumSet.noneOf(QuantifierProperty.class);
    +	public static Quantifier ONE() {
    +		return new Quantifier(QuantifierProperty.SINGLE);
    +	}
    +
    +	public static Quantifier ONE_OR_MORE() {
    +		return new Quantifier(QuantifierProperty.LOOPING, QuantifierProperty.EAGER);
    +	}
    +
    +	public static Quantifier TIMES() {
    +		return new Quantifier(QuantifierProperty.TIMES, QuantifierProperty.EAGER);
     	}
     
     	public boolean hasProperty(QuantifierProperty property) {
     		return properties.contains(property);
     	}
     
    +	public void combinations() {
    --- End diff --
    
    The first `if` will be satisfied by `ONE` resulting in misleading exception. Because of
that also the `else` branch of the second branch will not be reachable.


> Make times() eager and enable allowing combinations.
> ----------------------------------------------------
>
>                 Key: FLINK-6356
>                 URL: https://issues.apache.org/jira/browse/FLINK-6356
>             Project: Flink
>          Issue Type: Bug
>          Components: CEP
>    Affects Versions: 1.3.0
>            Reporter: Kostas Kloudas
>            Assignee: Kostas Kloudas
>             Fix For: 1.3.0
>
>
> This is the PR that addresses it https://github.com/apache/flink/pull/3761



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message