Class SimpleCondition<T>
- java.lang.Object
-
- org.apache.flink.cep.pattern.conditions.IterativeCondition<T>
-
- org.apache.flink.cep.pattern.conditions.SimpleCondition<T>
-
- All Implemented Interfaces:
Serializable
,FilterFunction<T>
,Function
- Direct Known Subclasses:
SubtypeCondition
@PublicEvolving public abstract class SimpleCondition<T> extends IterativeCondition<T> implements FilterFunction<T>
A user-defined condition that decides if an element should be accepted in the pattern or not. Accepting an element also signals a state transition for the correspondingNFA
.Contrary to the
IterativeCondition
, conditions that extend this class do not have access to the previously accepted elements in the pattern. Conditions that extend this class are simplefilter(...)
functions that decide based on the properties of the element at hand.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.cep.pattern.conditions.IterativeCondition
IterativeCondition.Context<T>
-
-
Constructor Summary
Constructors Constructor Description SimpleCondition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
filter(T value, IterativeCondition.Context<T> ctx)
The filter function that evaluates the predicate.static <T> SimpleCondition<T>
of(FilterFunction<T> filters)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.functions.FilterFunction
filter
-
-
-
-
Method Detail
-
filter
public boolean filter(T value, IterativeCondition.Context<T> ctx) throws Exception
Description copied from class:IterativeCondition
The filter function that evaluates the predicate.IMPORTANT: The system assumes that the function does not modify the elements on which the predicate is applied. Violating this assumption can lead to incorrect results.
- Specified by:
filter
in classIterativeCondition<T>
- Parameters:
value
- The value to be tested.ctx
- TheIterativeCondition.Context
used for the evaluation of the function and provides access to the already accepted events in the pattern (seeIterativeCondition.Context.getEventsForPattern(String)
).- Returns:
true
for values that should be retained,false
for values to be filtered out.- Throws:
Exception
- This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
-
of
public static <T> SimpleCondition<T> of(FilterFunction<T> filters)
-
-