Query and operator
In a find statement, you can specify the and operator in the event pattern. The conditions on both sides of the and operator must evaluate to true for the query to find a match. The condition on each side of an and operator can be a single event template or a more complex expression.
In the next example, assuming that an X event and a Y event have already been added to their respective windows, adding an A event to its window causes a match.
(X:x -> A:a1) and (Y:y -> A:a2)
In the second example, suppose events were added to their windows in this order: X(1), A(1), Y(1), A(2). The A(1)event is not included in the match set. Only A(2) is in the match set because it is the most recent A event to follow X(1) as well as the most recent A event to follow Y(1).
When a single event is used in more than one coassignment you must coassign the event, A in these examples, to distinct identifiers, a1 and a2 in these examples.
Specification of an and operator implies that there are no requirements regarding the order in which the events specified in the event pattern are added to the window. For example, events specified in the right-side condition can be added to their windows before events specified in the left-side condition. When conditions specify multiple events the events that cause one side of the and operator to evaluate to true
Can all be added to their windows before the events that cause the other side to evaluate to true
Can all be added to their windows after the events that cause the other side to evaluate to true
Can arrive in their windows at times interleaved with the arrival of the events that cause the other side to evaluate to true
Can contain the events that cause the other side to evaluate to true
Can be contained by the events that cause the other side to evaluate to true
When there is an order requirement or when you require multiple instances of the same event type specify the followed-by (->) operator.
The and operator has a higher precedence that the followed-by operator. For clarity, use brackets in expressions that specify both types of operators.