net.esper.pattern
Class EvalObserverStateNode

java.lang.Object
  extended by net.esper.pattern.EvalStateNode
      extended by net.esper.pattern.EvalObserverStateNode
All Implemented Interfaces:
ObserverEventEvaluator

public final class EvalObserverStateNode
extends EvalStateNode
implements ObserverEventEvaluator

This class represents the state of an eventObserver sub-expression in the evaluation state tree.


Constructor Summary
EvalObserverStateNode(Evaluator parentNode, ObserverFactory observerFactory, MatchedEventMap beginState, PatternContext context)
          Constructor.
 
Method Summary
 java.lang.Object accept(EvalStateNodeVisitor visitor, java.lang.Object data)
          Accept a visitor.
 java.lang.Object childrenAccept(EvalStateNodeVisitor visitor, java.lang.Object data)
          Pass the visitor to all child nodes.
 void observerEvaluateFalse()
          Indicate that the observer turned permanently false.
 void observerEvaluateTrue(MatchedEventMap matchEvent)
          Indicate an event for evaluation (sub-expression the observer represents has turned true).
protected  void quit()
          Stops the event expression or an instance of it.
 void start()
          Starts the event expression or an instance of it.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EvalObserverStateNode

public EvalObserverStateNode(Evaluator parentNode,
                             ObserverFactory observerFactory,
                             MatchedEventMap beginState,
                             PatternContext context)
Constructor.

Parameters:
parentNode - is the parent evaluator to call to indicate truth value
observerFactory - is the observer factory that makes observer instances
beginState - contains the events that make up prior matches
context - contains handles to services required
Method Detail

observerEvaluateTrue

public void observerEvaluateTrue(MatchedEventMap matchEvent)
Description copied from interface: ObserverEventEvaluator
Indicate an event for evaluation (sub-expression the observer represents has turned true).

Specified by:
observerEvaluateTrue in interface ObserverEventEvaluator
Parameters:
matchEvent - is the matched events so far

observerEvaluateFalse

public void observerEvaluateFalse()
Description copied from interface: ObserverEventEvaluator
Indicate that the observer turned permanently false.

Specified by:
observerEvaluateFalse in interface ObserverEventEvaluator

start

public final void start()
Description copied from class: EvalStateNode
Starts the event expression or an instance of it. Child classes are expected to initialize and start any event listeners or schedule any time-based callbacks as needed.

Specified by:
start in class EvalStateNode

quit

protected final void quit()
Description copied from class: EvalStateNode
Stops the event expression or an instance of it. Child classes are expected to free resources and stop any event listeners or remove any time-based callbacks.

Specified by:
quit in class EvalStateNode

accept

public final java.lang.Object accept(EvalStateNodeVisitor visitor,
                                     java.lang.Object data)
Description copied from class: EvalStateNode
Accept a visitor. Child classes are expected to invoke the visit method on the visitor instance passed in.

Specified by:
accept in class EvalStateNode
Parameters:
visitor - on which the visit method is invoked by each node
data - any additional data the visitor may need is passed in this parameter
Returns:
any additional data the visitor may need or null

childrenAccept

public final java.lang.Object childrenAccept(EvalStateNodeVisitor visitor,
                                             java.lang.Object data)
Description copied from class: EvalStateNode
Pass the visitor to all child nodes.

Specified by:
childrenAccept in class EvalStateNode
Parameters:
visitor - is the instance to be passed to all child nodes
data - any additional data the visitor may need is passed in this parameter
Returns:
any additional data the visitor may need or null

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object