Class/Object

org.apache.flink.cep.scala.pattern

Pattern

Related Docs: object Pattern | package pattern

Permalink

class Pattern[T, F <: T] extends AnyRef

Base class for a pattern definition.

A pattern definition is used by org.apache.flink.cep.nfa.compiler.NFACompiler to create a org.apache.flink.cep.nfa.NFA.

Pattern<T, F> pattern = Pattern.<T>begin("start")
  .next("middle").subtype(F.class)
  .followedBy("end").where(new MyCondition());
T

Base type of the elements appearing in the pattern

F

Subtype of T to which the current pattern operator is constrained

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Pattern
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Pattern(jPattern: pattern.Pattern[T, F])

    Permalink

    jPattern

    Underlying Java API Pattern

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def allowCombinations(): Pattern[T, F]

    Permalink

    Applicable only to Quantifier.looping() and Quantifier.times() patterns, this option allows more flexibility to the matching events.

    Applicable only to Quantifier.looping() and Quantifier.times() patterns, this option allows more flexibility to the matching events.

    If

    allowCombinations()

    is not applied for a pattern

    A.oneOrMore().followedBy(B)

    and a sequence of events

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A.oneOrMore().followedBy(B) }}}

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    allowCombinations() }}} pattern

    A.oneOrMore().followedBy(B)

    and a sequence of events

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A.oneOrMore().followedBy(B) }}}

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . If this method is applied, we will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 A2 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    A1 B }}} will have

    A1 B

    ,

    A2 B

    and

    A1 A2 B

    .

    A1 A2 B }}}

    A2 B }}}

    A1 B }}}

    returns

    The same pattern with the updated quantifier.

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def consecutive(): Pattern[T, F]

    Permalink

    Works in conjunction with Pattern#oneOrMore() or Pattern#times(int).

    Works in conjunction with Pattern#oneOrMore() or Pattern#times(int). Specifies that any not matching element breaks the loop.

    E.g. a pattern like:

    Pattern.begin("start").where(_.getName().equals("c"))
           .followedBy("middle").where(_.getName().equals("a")).oneOrMore().consecutive()
           .followedBy("end1").where(_.getName().equals("b"));

    For a sequence: C D A1 A2 A3 D A4 B

    will generate matches: {C A1 B}, {C A1 A2 B}, {C A1 A2 A3 B}

    By default a relaxed continuity is applied.

    returns

    pattern with continuity changed to strict

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def followedBy(pattern: Pattern[T, F]): GroupPattern[T, F]

    Permalink

    Appends a new group pattern to the existing one.

    Appends a new group pattern to the existing one. The new pattern enforces non-strict temporal contiguity. This means that a matching event of this pattern and the preceding matching event might be interleaved with other events which are ignored.

    pattern

    the pattern to append

    returns

    A new pattern which is appended to this one

  12. def followedBy(name: String): Pattern[T, T]

    Permalink

    Appends a new pattern to the existing one.

    Appends a new pattern to the existing one. The new pattern enforces non-strict temporal contiguity. This means that a matching event of this pattern and the preceding matching event might be interleaved with other events which are ignored.

    name

    Name of the new pattern

    returns

    A new pattern which is appended to this one

  13. def followedByAny(pattern: Pattern[T, F]): GroupPattern[T, F]

    Permalink

    Appends a new group pattern to the existing one.

    Appends a new group pattern to the existing one. The new pattern enforces non-strict temporal contiguity. This means that a matching event of this pattern and the preceding matching event might be interleaved with other events which are ignored.

    pattern

    the pattern to append

    returns

    A new pattern which is appended to this one

  14. def followedByAny(name: String): Pattern[T, T]

    Permalink

    Appends a new pattern to the existing one.

    Appends a new pattern to the existing one. The new pattern enforces non-strict temporal contiguity. This means that a matching event of this pattern and the preceding matching event might be interleaved with other events which are ignored.

    name

    Name of the new pattern

    returns

    A new pattern which is appended to this one

  15. def getAfterMatchSkipStrategy: AfterMatchSkipStrategy

    Permalink

    Get after match skip strategy.

    Get after match skip strategy.

    returns

    current after match skip strategy

  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def getCondition: Option[IterativeCondition[F]]

    Permalink
  18. def getName: String

    Permalink

    returns

    Name of the pattern operator

  19. def getPrevious: Option[Pattern[T, _ <: T]]

    Permalink

    returns

    The previous pattern

  20. def getQuantifier: Quantifier

    Permalink

    returns

    currently applied quantifier to this pattern

  21. def getUntilCondition: Option[IterativeCondition[F]]

    Permalink
  22. def getWindowTime: Option[Time]

    Permalink

    returns

    Window length in which the pattern match has to occur

  23. def greedy: Pattern[T, F]

    Permalink

    Specifies that this pattern is greedy.

    Specifies that this pattern is greedy. This means as many events as possible will be matched to this pattern.

    returns

    The same pattern with { @link Quantifier#greedy} set to true.

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  24. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  25. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  26. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. def next(pattern: Pattern[T, F]): GroupPattern[T, F]

    Permalink

    Appends a new group pattern to the existing one.

    Appends a new group pattern to the existing one. The new pattern enforces strict temporal contiguity. This means that the whole pattern sequence matches only if an event which matches this pattern directly follows the preceding matching event. Thus, there cannot be any events in between two matching events.

    pattern

    the pattern to append

    returns

    A new pattern which is appended to this one

  28. def next(name: String): Pattern[T, T]

    Permalink

    Appends a new pattern to the existing one.

    Appends a new pattern to the existing one. The new pattern enforces strict temporal contiguity. This means that the whole pattern sequence matches only if an event which matches this pattern directly follows the preceding matching event. Thus, there cannot be any events in between two matching events.

    name

    Name of the new pattern

    returns

    A new pattern which is appended to this one

  29. def notFollowedBy(name: String): Pattern[T, T]

    Permalink

    Appends a new pattern to the existing one.

    Appends a new pattern to the existing one. The new pattern enforces that there is no event matching this pattern between the preceding pattern and succeeding this one.

    NOTE: There has to be other pattern after this one.

    name

    Name of the new pattern

    returns

    A new pattern which is appended to this one

  30. def notNext(name: String): Pattern[T, T]

    Permalink

    Appends a new pattern to the existing one.

    Appends a new pattern to the existing one. The new pattern enforces that there is no event matching this pattern right after the preceding matched event.

    name

    Name of the new pattern

    returns

    A new pattern which is appended to this one

  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. def oneOrMore: Pattern[T, F]

    Permalink

    Specifies that this pattern can occur

    Specifies that this pattern can occur

    one or more

    times. This means at least one and at most infinite number of events can be matched to this pattern.

    If this quantifier is enabled for a pattern

    A.oneOrMore().followedBy(B)

    and a sequence of events

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    A.oneOrMore().followedBy(B) }}}

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    one or more }}} This means at least one and at most infinite number of events can be matched to this pattern.

    If this quantifier is enabled for a pattern

    A.oneOrMore().followedBy(B)

    and a sequence of events

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    A.oneOrMore().followedBy(B) }}}

    A1 A2 B

    appears, this will generate patterns:

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    A1 A2 B }}}

    A1 B

    and

    A1 A2 B

    . See also

    allowCombinations()

    .

    allowCombinations() }}}

    A1 A2 B }}}

    A1 B }}}

    returns

    The same pattern with a Quantifier.looping() quantifier applied.

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  34. def optional: Pattern[T, F]

    Permalink

    Specifies that this pattern is optional for a final match of the pattern sequence to happen.

    Specifies that this pattern is optional for a final match of the pattern sequence to happen.

    returns

    The same pattern as optional.

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  35. def or(condition: (F, Context[F]) ⇒ Boolean): Pattern[T, F]

    Permalink

    Adds a condition that has to be satisfied by an event in order to be considered a match.

    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

    OR

    . In other case, this is going to be the only condition.

    OR }}} condition.

    condition

    The

    OR
    returns

    The pattern with the new condition is set.

  36. def or(condition: (F) ⇒ Boolean): Pattern[T, F]

    Permalink

    Adds a condition that has to be satisfied by an event in order to be considered a match.

    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

    OR

    . In other case, this is going to be the only condition.

    OR }}} condition.

    condition

    The

    OR
    returns

    The pattern with the new condition is set.

  37. def or(condition: IterativeCondition[F]): Pattern[T, F]

    Permalink

    Adds a condition that has to be satisfied by an event in order to be considered a match.

    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

    OR

    . In other case, this is going to be the only condition.

    OR }}} condition.

    condition

    The condition as an IterativeCondition.

    returns

    The pattern with the new condition is set.

  38. def subtype[S <: F](clazz: Class[S]): Pattern[T, S]

    Permalink

    Applies a subtype constraint on the current pattern.

    Applies a subtype constraint on the current pattern. This means that an event has to be of the given subtype in order to be matched.

    S

    Type of the subtype

    clazz

    Class of the subtype

    returns

    The same pattern with the new subtype constraint

  39. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  40. def times(from: Int, to: Int): Pattern[T, F]

    Permalink

    Specifies that the pattern can occur between from and to times.

    Specifies that the pattern can occur between from and to times.

    from

    number of times matching event must appear at least

    to

    number of times matching event must appear at most

    returns

    The same pattern with the number of times range applied

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  41. def times(times: Int): Pattern[T, F]

    Permalink

    Specifies exact number of times that this pattern should be matched.

    Specifies exact number of times that this pattern should be matched.

    times

    number of times matching event must appear

    returns

    The same pattern with number of times applied

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  42. def timesOrMore(times: Int): Pattern[T, F]

    Permalink

    Specifies that this pattern can occur the specified times at least.

    Specifies that this pattern can occur the specified times at least. This means at least the specified times and at most infinite number of events can be matched to this pattern.

    returns

    The same pattern with a { @link Quantifier#looping(ConsumingStrategy)} quantifier applied.

    Exceptions thrown

    MalformedPatternException if the quantifier is not applicable to this pattern.

  43. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  44. def until(untilCondition: (F) ⇒ Boolean): Pattern[T, F]

    Permalink

    Applies a stop condition for a looping state.

    Applies a stop condition for a looping state. It allows cleaning the underlying state.

    untilCondition

    a condition an event has to satisfy to stop collecting events into looping state

    returns

    The same pattern with applied untilCondition

  45. def until(untilCondition: (F, Context[F]) ⇒ Boolean): Pattern[T, F]

    Permalink

    Applies a stop condition for a looping state.

    Applies a stop condition for a looping state. It allows cleaning the underlying state.

    untilCondition

    a condition an event has to satisfy to stop collecting events into looping state

    returns

    The same pattern with applied untilCondition

  46. def until(untilCondition: IterativeCondition[F]): Pattern[T, F]

    Permalink

    Applies a stop condition for a looping state.

    Applies a stop condition for a looping state. It allows cleaning the underlying state.

    untilCondition

    a condition an event has to satisfy to stop collecting events into looping state

    returns

    The same pattern with applied untilCondition

  47. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. def where(condition: (F) ⇒ Boolean): Pattern[T, F]

    Permalink

    Adds a condition that has to be satisfied by an event in order to be considered a match.

    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

    AND

    . In other case, this is going to be the only condition.

    AND }}} condition.

    condition

    The condition to be set.

    returns

    The pattern with the new condition is set.

  51. def where(condition: (F, Context[F]) ⇒ Boolean): Pattern[T, F]

    Permalink

    Adds a condition that has to be satisfied by an event in order to be considered a match.

    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

    AND

    . In other case, this is going to be the only condition.

    AND }}} condition.

    condition

    The condition to be set.

    returns

    The pattern with the new condition is set.

  52. def where(condition: IterativeCondition[F]): Pattern[T, F]

    Permalink

    Adds a condition that has to be satisfied by an event in order to be considered a match.

    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

    AND

    . In other case, this is going to be the only condition.

    AND }}} condition.

    condition

    The condition as an IterativeCondition.

    returns

    The pattern with the new condition is set.

  53. def within(windowTime: Time): Pattern[T, F]

    Permalink

    Defines the maximum time interval in which a matching pattern has to be completed in order to be considered valid.

    Defines the maximum time interval in which a matching pattern has to be completed in order to be considered valid. This interval corresponds to the maximum time gap between first and the last event.

    windowTime

    Time of the matching window

    returns

    The same pattern operator with the new window length

Inherited from AnyRef

Inherited from Any

Ungrouped