Class Patterns
java.lang.Object
com.espertech.esper.common.client.soda.Patterns
Convenience factory for creating
PatternExpr
instances, which represent pattern expression trees.
Provides quick-access method to create all possible pattern expressions and provides typical parameter lists to each.
Note that only the typical parameter lists are provided and pattern expressions can allow adding additional parameters.
Many expressions, for example logical AND and OR (conjunction and disjunction), allow adding an unlimited number of additional sub-expressions to a pattern expression. For those pattern expressions there are additional add methods.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PatternAndExpr
and()
Pattern-AND expression, allows adding sub-expressions that are connected by a logical AND.static PatternAndExpr
and
(PatternExpr first, PatternExpr second, PatternExpr... more) Pattern-AND expression, allows adding sub-expressions that are connected by a logical AND.static PatternEveryExpr
every
(PatternExpr inner) Pattern-every expression control the lifecycle of the pattern sub-expression.static PatternEveryExpr
everyFilter
(Filter filter) Pattern every-operator and filter in combination, equivalent to the "every MyEvent(vol > 100)" syntax.static PatternEveryExpr
everyFilter
(Filter filter, String tagName) Pattern every-operator and filter in combination, equivalent to the "every tag=MyEvent(vol > 100)" syntax.static PatternEveryExpr
everyFilter
(String eventTypeName) Pattern every-operator and filter in combination, equivalent to the "every MyEvent" syntax.static PatternEveryExpr
everyFilter
(String eventTypeName, String tagName) Pattern every-operator and filter in combination, equivalent to the "every tag=MyEvent" syntax.static PatternFilterExpr
Filter expression for use in patterns, equivalent to the "MyEvent(vol > 100)" syntax.static PatternFilterExpr
Filter expression for use in patterns, equivalent to the "tag=MyEvent(vol > 100)" syntax.static PatternFilterExpr
Filter expression for use in patterns, equivalent to the simple "MyEvent" syntax.static PatternFilterExpr
Filter expression for use in patterns, equivalent to the simple "tag=MyEvent" syntax.static PatternFollowedByExpr
Pattern followed-by expression, allows adding sub-expressions that are connected by a followed-by.static PatternFollowedByExpr
followedBy
(PatternExpr first, PatternExpr second, PatternExpr... more) Pattern followed-by expression, allows adding sub-expressions that are connected by a followed-by.static PatternGuardExpr
guard
(String namespace, String name, Expression[] parameters, PatternExpr guarded) Guard pattern expression guards a sub-expression, equivalent to the "every MyEvent where timer:within(1 sec)" syntaxstatic PatternMatchUntilExpr
matchUntil
(Expression low, Expression high, PatternExpr match, PatternExpr until) Match-until-pattern expression matches a certain number of occurances until a second expression becomes true.static PatternNotExpr
not
(PatternExpr subexpression) Not-keyword pattern expression flips the truth-value of the pattern sub-expression.static PatternNotExpr
Pattern not-operator and filter in combination, equivalent to the "not MyEvent(vol > 100)" syntax.static PatternNotExpr
Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent(vol > 100)" syntax.static PatternNotExpr
Pattern not-operator and filter in combination, equivalent to the "not MyEvent" syntax.static PatternNotExpr
Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent" syntax.static PatternObserverExpr
observer
(String namespace, String name, Expression[] parameters) Observer pattern expression, equivalent to the "every timer:interval(1 sec)" syntaxstatic PatternOrExpr
or()
Pattern-OR expression, allows adding sub-expressions that are connected by a logical OR.static PatternOrExpr
or
(PatternExpr first, PatternExpr second, PatternExpr... more) Pattern-OR expression, allows adding sub-expressions that are connected by a logical OR.static PatternObserverExpr
timerAt
(Integer minutes, Integer hours, Integer daysOfMonth, Integer month, Integer daysOfWeek, Integer seconds) Timer-at observerstatic PatternObserverExpr
timerInterval
(double seconds) Timer-interval observer expression.static PatternGuardExpr
timerWithin
(double seconds, PatternExpr guarded) Timer-within guard expression.static PatternGuardExpr
timerWithinMax
(double seconds, int max, PatternExpr guarded) Timer-within-max guard expression.static PatternGuardExpr
whileGuard
(PatternExpr guarded, Expression expression) While-guard expression.
-
Constructor Details
-
Patterns
public Patterns()
-
-
Method Details
-
every
Pattern-every expression control the lifecycle of the pattern sub-expression.- Parameters:
inner
- sub-expression to the every-keyword- Returns:
- pattern expression
-
and
Pattern-AND expression, allows adding sub-expressions that are connected by a logical AND.- Returns:
- pattern expression representing the AND relationship
-
and
Pattern-AND expression, allows adding sub-expressions that are connected by a logical AND.- Parameters:
first
- is the first pattern sub-expression to add to the ANDsecond
- is a second pattern sub-expression to add to the ANDmore
- is optional additional pattern sub-expression to add to the AND- Returns:
- pattern expression representing the AND relationship
-
or
Pattern-OR expression, allows adding sub-expressions that are connected by a logical OR.- Parameters:
first
- is the first pattern sub-expression to add to the ORsecond
- is a second pattern sub-expression to add to the ORmore
- is optional additional pattern sub-expression to add to the OR- Returns:
- pattern expression representing the OR relationship
-
or
Pattern-OR expression, allows adding sub-expressions that are connected by a logical OR.- Returns:
- pattern expression representing the OR relationship
-
followedBy
public static PatternFollowedByExpr followedBy(PatternExpr first, PatternExpr second, PatternExpr... more) Pattern followed-by expression, allows adding sub-expressions that are connected by a followed-by.- Parameters:
first
- is the first pattern sub-expression to add to the followed-bysecond
- is a second pattern sub-expression to add to the followed-bymore
- is optional additional pattern sub-expression to add to the followed-by- Returns:
- pattern expression representing the followed-by relationship
-
followedBy
Pattern followed-by expression, allows adding sub-expressions that are connected by a followed-by.- Returns:
- pattern expression representing the followed-by relationship
-
everyFilter
Pattern every-operator and filter in combination, equivalent to the "every MyEvent" syntax.- Parameters:
eventTypeName
- is the event type name to filter for- Returns:
- pattern expression
-
everyFilter
Pattern every-operator and filter in combination, equivalent to the "every tag=MyEvent" syntax.- Parameters:
eventTypeName
- is the event type name to filter fortagName
- is the tag name to assign to matching events- Returns:
- pattern expression
-
everyFilter
Pattern every-operator and filter in combination, equivalent to the "every MyEvent(vol > 100)" syntax.- Parameters:
filter
- specifies the event type name and filter expression to filter for- Returns:
- pattern expression
-
everyFilter
Pattern every-operator and filter in combination, equivalent to the "every tag=MyEvent(vol > 100)" syntax.- Parameters:
filter
- specifies the event type name and filter expression to filter fortagName
- is the tag name to assign to matching events- Returns:
- pattern expression
-
filter
Filter expression for use in patterns, equivalent to the simple "MyEvent" syntax.- Parameters:
eventTypeName
- is the event type name of the events to filter for- Returns:
- pattern expression
-
filter
Filter expression for use in patterns, equivalent to the simple "tag=MyEvent" syntax.- Parameters:
eventTypeName
- is the event type name of the events to filter fortagName
- is the tag name to assign to matching events- Returns:
- pattern expression
-
filter
Filter expression for use in patterns, equivalent to the "MyEvent(vol > 100)" syntax.- Parameters:
filter
- specifies the event type name and filter expression to filter for- Returns:
- pattern expression
-
filter
Filter expression for use in patterns, equivalent to the "tag=MyEvent(vol > 100)" syntax.- Parameters:
filter
- specifies the event type name and filter expression to filter fortagName
- is the tag name to assign to matching events- Returns:
- pattern expression
-
guard
public static PatternGuardExpr guard(String namespace, String name, Expression[] parameters, PatternExpr guarded) Guard pattern expression guards a sub-expression, equivalent to the "every MyEvent where timer:within(1 sec)" syntax- Parameters:
namespace
- is the guard objects namespace, i.e. "timer"name
- is the guard objects name, i.e. ""within"parameters
- is the guard objects optional parameters, i.e. integer 1 for 1 secondguarded
- is the pattern sub-expression to be guarded- Returns:
- pattern guard expression
-
observer
Observer pattern expression, equivalent to the "every timer:interval(1 sec)" syntax- Parameters:
namespace
- is the observer objects namespace, i.e. "timer"name
- is the observer objects name, i.e. ""within"parameters
- is the observer objects optional parameters, i.e. integer 1 for 1 second- Returns:
- pattern observer expression
-
timerWithin
Timer-within guard expression.- Parameters:
seconds
- is the number of seconds for the guardguarded
- is the sub-expression to guard- Returns:
- pattern guard
-
whileGuard
While-guard expression.- Parameters:
expression
- expression to evaluate against matchesguarded
- is the sub-expression to guard- Returns:
- pattern guard
-
timerWithinMax
Timer-within-max guard expression.- Parameters:
seconds
- is the number of seconds for the guardmax
- the maximum number of invocations for the guardguarded
- is the sub-expression to guard- Returns:
- pattern guard
-
timerInterval
Timer-interval observer expression.- Parameters:
seconds
- is the number of seconds in the interval- Returns:
- pattern observer
-
notFilter
Pattern not-operator and filter in combination, equivalent to the "not MyEvent" syntax.- Parameters:
eventTypeName
- is the event type name to filter for- Returns:
- pattern expression
-
notFilter
Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent" syntax.- Parameters:
name
- is the event type name to filter fortagName
- is the tag name to assign to matching events- Returns:
- pattern expression
-
notFilter
Pattern not-operator and filter in combination, equivalent to the "not MyEvent(vol > 100)" syntax.- Parameters:
filter
- specifies the event type name and filter expression to filter for- Returns:
- pattern expression
-
notFilter
Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent(vol > 100)" syntax.- Parameters:
filter
- specifies the event type name and filter expression to filter fortagName
- is the tag name to assign to matching events- Returns:
- pattern expression
-
not
Not-keyword pattern expression flips the truth-value of the pattern sub-expression.- Parameters:
subexpression
- is the expression whose truth value to flip- Returns:
- pattern expression
-
matchUntil
public static PatternMatchUntilExpr matchUntil(Expression low, Expression high, PatternExpr match, PatternExpr until) Match-until-pattern expression matches a certain number of occurances until a second expression becomes true.- Parameters:
low
- - low number of matches, or null if no lower boundaryhigh
- - high number of matches, or null if no high boundarymatch
- - the pattern expression that is sought to match repeatedlyuntil
- - the pattern expression that ends matching (optional, can be null)- Returns:
- pattern expression
-
timerAt
public static PatternObserverExpr timerAt(Integer minutes, Integer hours, Integer daysOfMonth, Integer month, Integer daysOfWeek, Integer seconds) Timer-at observer- Parameters:
minutes
- a single integer value supplying the minute to fire the timer, or null for any (wildcard) minutehours
- a single integer value supplying the hour to fire the timer, or null for any (wildcard) hourdaysOfMonth
- a single integer value supplying the day of the month to fire the timer, or null for any (wildcard) day of the monthmonth
- a single integer value supplying the month to fire the timer, or null for any (wildcard) monthdaysOfWeek
- a single integer value supplying the days of the week to fire the timer, or null for any (wildcard) day of the weekseconds
- a single integer value supplying the second to fire the timer, or null for any (wildcard) second- Returns:
- timer-at observer
-