public class Patterns extends Object
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 and Description |
---|
Patterns() |
Modifier and Type | Method and Description |
---|---|
static 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(Filter filter)
Filter expression for use in patterns, equivalent to the "MyEvent(vol > 100)" syntax.
|
static PatternFilterExpr |
filter(Filter filter,
String tagName)
Filter expression for use in patterns, equivalent to the "tag=MyEvent(vol > 100)" syntax.
|
static PatternFilterExpr |
filter(String eventTypeName)
Filter expression for use in patterns, equivalent to the simple "MyEvent" syntax.
|
static PatternFilterExpr |
filter(String eventTypeName,
String tagName)
Filter expression for use in patterns, equivalent to the simple "tag=MyEvent" syntax.
|
static PatternFollowedByExpr |
followedBy()
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)" syntax
|
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.
|
static PatternNotExpr |
not(PatternExpr subexpression)
Not-keyword pattern expression flips the truth-value of the pattern sub-expression.
|
static PatternNotExpr |
notFilter(Filter filter)
Pattern not-operator and filter in combination, equivalent to the "not MyEvent(vol > 100)" syntax.
|
static PatternNotExpr |
notFilter(Filter filter,
String tagName)
Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent(vol > 100)" syntax.
|
static PatternNotExpr |
notFilter(String eventTypeName)
Pattern not-operator and filter in combination, equivalent to the "not MyEvent" syntax.
|
static PatternNotExpr |
notFilter(String name,
String tagName)
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)" syntax
|
static 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 observer
|
static 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.
|
public static PatternEveryExpr every(PatternExpr inner)
inner
- sub-expression to the every-keywordpublic static PatternAndExpr and()
public static PatternAndExpr and(PatternExpr first, PatternExpr second, PatternExpr... more)
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 ANDpublic static PatternOrExpr or(PatternExpr first, PatternExpr second, PatternExpr... more)
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 ORpublic static PatternOrExpr or()
public static PatternFollowedByExpr followedBy(PatternExpr first, PatternExpr second, PatternExpr... more)
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-bypublic static PatternFollowedByExpr followedBy()
public static PatternEveryExpr everyFilter(String eventTypeName)
eventTypeName
- is the event type name to filter forpublic static PatternEveryExpr everyFilter(String eventTypeName, String tagName)
eventTypeName
- is the event type name to filter fortagName
- is the tag name to assign to matching eventspublic static PatternEveryExpr everyFilter(Filter filter)
filter
- specifies the event type name and filter expression to filter forpublic static PatternEveryExpr everyFilter(Filter filter, String tagName)
filter
- specifies the event type name and filter expression to filter fortagName
- is the tag name to assign to matching eventspublic static PatternFilterExpr filter(String eventTypeName)
eventTypeName
- is the event type name of the events to filter forpublic static PatternFilterExpr filter(String eventTypeName, String tagName)
eventTypeName
- is the event type name of the events to filter fortagName
- is the tag name to assign to matching eventspublic static PatternFilterExpr filter(Filter filter)
filter
- specifies the event type name and filter expression to filter forpublic static PatternFilterExpr filter(Filter filter, String tagName)
filter
- specifies the event type name and filter expression to filter fortagName
- is the tag name to assign to matching eventspublic static PatternGuardExpr guard(String namespace, String name, Expression[] parameters, PatternExpr guarded)
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 guardedpublic static PatternObserverExpr observer(String namespace, String name, Expression[] 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 secondpublic static PatternGuardExpr timerWithin(double seconds, PatternExpr guarded)
seconds
- is the number of seconds for the guardguarded
- is the sub-expression to guardpublic static PatternGuardExpr whileGuard(PatternExpr guarded, Expression expression)
expression
- expression to evaluate against matchesguarded
- is the sub-expression to guardpublic static PatternGuardExpr timerWithinMax(double seconds, int max, PatternExpr guarded)
seconds
- is the number of seconds for the guardmax
- the maximum number of invocations for the guardguarded
- is the sub-expression to guardpublic static PatternObserverExpr timerInterval(double seconds)
seconds
- is the number of seconds in the intervalpublic static PatternNotExpr notFilter(String eventTypeName)
eventTypeName
- is the event type name to filter forpublic static PatternNotExpr notFilter(String name, String tagName)
name
- is the event type name to filter fortagName
- is the tag name to assign to matching eventspublic static PatternNotExpr notFilter(Filter filter)
filter
- specifies the event type name and filter expression to filter forpublic static PatternNotExpr notFilter(Filter filter, String tagName)
filter
- specifies the event type name and filter expression to filter fortagName
- is the tag name to assign to matching eventspublic static PatternNotExpr not(PatternExpr subexpression)
subexpression
- is the expression whose truth value to flippublic static PatternMatchUntilExpr matchUntil(Expression low, Expression high, PatternExpr match, PatternExpr until)
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)public static PatternObserverExpr timerAt(Integer minutes, Integer hours, Integer daysOfMonth, Integer month, Integer daysOfWeek, Integer seconds)
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