org.apache.flink.cep.pattern.conditions.RichOrCondition Java Examples
The following examples show how to use
org.apache.flink.cep.pattern.conditions.RichOrCondition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Pattern.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Adds a condition that has to be satisfied by an event * in order to be considered a match. If another condition has already been * set, the new one is going to be combined with the previous with a * logical {@code OR}. In other case, this is going to be the only * condition. * * @param condition The condition as an {@link IterativeCondition}. * @return The pattern with the new condition is set. */ public Pattern<T, F> or(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, ExecutionConfig.ClosureCleanerLevel.RECURSIVE, true); if (this.condition == null) { this.condition = condition; } else { this.condition = new RichOrCondition<>(this.condition, condition); } return this; }
Example #2
Source File: PatternTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testRichCondition() { Pattern<Event, Event> pattern = Pattern.<Event>begin("start") .where(mock(IterativeCondition.class)) .where(mock(IterativeCondition.class)) .followedBy("end") .where(mock(IterativeCondition.class)) .or(mock(IterativeCondition.class)); assertTrue(pattern.getCondition() instanceof RichOrCondition); assertTrue(pattern.getPrevious().getCondition() instanceof RichAndCondition); }
Example #3
Source File: Pattern.java From flink with Apache License 2.0 | 5 votes |
/** * Adds a condition that has to be satisfied by an event * in order to be considered a match. If another condition has already been * set, the new one is going to be combined with the previous with a * logical {@code OR}. In other case, this is going to be the only * condition. * * @param condition The condition as an {@link IterativeCondition}. * @return The pattern with the new condition is set. */ public Pattern<T, F> or(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, ExecutionConfig.ClosureCleanerLevel.RECURSIVE, true); if (this.condition == null) { this.condition = condition; } else { this.condition = new RichOrCondition<>(this.condition, condition); } return this; }
Example #4
Source File: PatternTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testRichCondition() { Pattern<Event, Event> pattern = Pattern.<Event>begin("start") .where(mock(IterativeCondition.class)) .where(mock(IterativeCondition.class)) .followedBy("end") .where(mock(IterativeCondition.class)) .or(mock(IterativeCondition.class)); assertTrue(pattern.getCondition() instanceof RichOrCondition); assertTrue(pattern.getPrevious().getCondition() instanceof RichAndCondition); }
Example #5
Source File: Pattern.java From flink with Apache License 2.0 | 5 votes |
/** * Adds a condition that has to be satisfied by an event * in order to be considered a match. If another condition has already been * set, the new one is going to be combined with the previous with a * logical {@code OR}. In other case, this is going to be the only * condition. * * @param condition The condition as an {@link IterativeCondition}. * @return The pattern with the new condition is set. */ public Pattern<T, F> or(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, ExecutionConfig.ClosureCleanerLevel.RECURSIVE, true); if (this.condition == null) { this.condition = condition; } else { this.condition = new RichOrCondition<>(this.condition, condition); } return this; }
Example #6
Source File: PatternTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testRichCondition() { Pattern<Event, Event> pattern = Pattern.<Event>begin("start") .where(mock(IterativeCondition.class)) .where(mock(IterativeCondition.class)) .followedBy("end") .where(mock(IterativeCondition.class)) .or(mock(IterativeCondition.class)); assertTrue(pattern.getCondition() instanceof RichOrCondition); assertTrue(pattern.getPrevious().getCondition() instanceof RichAndCondition); }