Developing Apama Applications > Developing Apama Applications in EPL > Defining Event Listeners > Specifying and/or/not logic in event listeners > Specifying the not operator in event expressions
Specifying the not operator in event expressions
The not operator is unary and acts to invert the truth value of the event expression it is applied to.
on ((A() -> B()) and not C()) executeAction();
therefore means that the event listener will trigger executeAction only if it encounters an A followed by a B without a C occurring at any time before the B is encountered.
The not operator can cause an event expression to reach a state where it can never evaluate to true. That is, it becomes permanently false.
Consider the above event listener event pattern: on (A() -> B()) and not C()
The event listener starts by seeking both A -> B and not C concurrently. If an event matching C is received before one matching B, the C clause evaluates to true, and hence not C becomes false. This means that (A -> B) and not C can never evaluate to true, and hence this event listener will never trigger. The correlator terminates these zombie event listeners periodically.
It is possible to specify the not operator in an event expression in such a way that the expression always evaluates to true immediately. Since this triggers the specified action without any events occurring, you want to avoid doing this. See Avoiding event listeners that trigger upon instantiation.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.