Class Patterns

java.lang.Object
com.espertech.esper.common.client.soda.Patterns

public class Patterns extends Object
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 Details

    • Patterns

      public Patterns()
  • Method Details

    • every

      public static PatternEveryExpr every(PatternExpr inner)
      Pattern-every expression control the lifecycle of the pattern sub-expression.
      Parameters:
      inner - sub-expression to the every-keyword
      Returns:
      pattern expression
    • and

      public static PatternAndExpr and()
      Pattern-AND expression, allows adding sub-expressions that are connected by a logical AND.
      Returns:
      pattern expression representing the AND relationship
    • and

      public static PatternAndExpr and(PatternExpr first, PatternExpr second, PatternExpr... more)
      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 AND
      second - is a second pattern sub-expression to add to the AND
      more - is optional additional pattern sub-expression to add to the AND
      Returns:
      pattern expression representing the AND relationship
    • or

      public static PatternOrExpr or(PatternExpr first, PatternExpr second, PatternExpr... more)
      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 OR
      second - is a second pattern sub-expression to add to the OR
      more - is optional additional pattern sub-expression to add to the OR
      Returns:
      pattern expression representing the OR relationship
    • or

      public static PatternOrExpr 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-by
      second - is a second pattern sub-expression to add to the followed-by
      more - is optional additional pattern sub-expression to add to the followed-by
      Returns:
      pattern expression representing the followed-by relationship
    • followedBy

      public static PatternFollowedByExpr 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

      public static PatternEveryExpr everyFilter(String eventTypeName)
      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

      public static PatternEveryExpr everyFilter(String eventTypeName, String tagName)
      Pattern every-operator and filter in combination, equivalent to the "every tag=MyEvent" syntax.
      Parameters:
      eventTypeName - is the event type name to filter for
      tagName - is the tag name to assign to matching events
      Returns:
      pattern expression
    • everyFilter

      public static PatternEveryExpr everyFilter(Filter filter)
      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

      public static PatternEveryExpr everyFilter(Filter filter, String tagName)
      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 for
      tagName - is the tag name to assign to matching events
      Returns:
      pattern expression
    • filter

      public static PatternFilterExpr filter(String eventTypeName)
      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

      public static PatternFilterExpr filter(String eventTypeName, String tagName)
      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 for
      tagName - is the tag name to assign to matching events
      Returns:
      pattern expression
    • filter

      public static PatternFilterExpr filter(Filter 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

      public static PatternFilterExpr filter(Filter filter, String tagName)
      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 for
      tagName - 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 second
      guarded - is the pattern sub-expression to be guarded
      Returns:
      pattern guard expression
    • observer

      public static PatternObserverExpr observer(String namespace, String name, Expression[] parameters)
      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

      public static PatternGuardExpr timerWithin(double seconds, PatternExpr guarded)
      Timer-within guard expression.
      Parameters:
      seconds - is the number of seconds for the guard
      guarded - is the sub-expression to guard
      Returns:
      pattern guard
    • whileGuard

      public static PatternGuardExpr whileGuard(PatternExpr guarded, Expression expression)
      While-guard expression.
      Parameters:
      expression - expression to evaluate against matches
      guarded - is the sub-expression to guard
      Returns:
      pattern guard
    • timerWithinMax

      public static PatternGuardExpr timerWithinMax(double seconds, int max, PatternExpr guarded)
      Timer-within-max guard expression.
      Parameters:
      seconds - is the number of seconds for the guard
      max - the maximum number of invocations for the guard
      guarded - is the sub-expression to guard
      Returns:
      pattern guard
    • timerInterval

      public static PatternObserverExpr timerInterval(double seconds)
      Timer-interval observer expression.
      Parameters:
      seconds - is the number of seconds in the interval
      Returns:
      pattern observer
    • notFilter

      public static PatternNotExpr notFilter(String eventTypeName)
      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

      public static PatternNotExpr notFilter(String name, String tagName)
      Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent" syntax.
      Parameters:
      name - is the event type name to filter for
      tagName - is the tag name to assign to matching events
      Returns:
      pattern expression
    • notFilter

      public static PatternNotExpr notFilter(Filter filter)
      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

      public static PatternNotExpr notFilter(Filter filter, String tagName)
      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 for
      tagName - is the tag name to assign to matching events
      Returns:
      pattern expression
    • not

      public static PatternNotExpr not(PatternExpr subexpression)
      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 boundary
      high - - high number of matches, or null if no high boundary
      match - - the pattern expression that is sought to match repeatedly
      until - - 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) minute
      hours - a single integer value supplying the hour to fire the timer, or null for any (wildcard) hour
      daysOfMonth - a single integer value supplying the day of the month to fire the timer, or null for any (wildcard) day of the month
      month - a single integer value supplying the month to fire the timer, or null for any (wildcard) month
      daysOfWeek - a single integer value supplying the days of the week to fire the timer, or null for any (wildcard) day of the week
      seconds - a single integer value supplying the second to fire the timer, or null for any (wildcard) second
      Returns:
      timer-at observer