net.esper.pattern
Class EvalStateNode

java.lang.Object
  extended by net.esper.pattern.EvalStateNode
Direct Known Subclasses:
EvalAndStateNode, EvalEveryStateNode, EvalFilterStateNode, EvalFollowedByStateNode, EvalGuardStateNode, EvalNotStateNode, EvalObserverStateNode, EvalOrStateNode, EvalRootStateNode

public abstract class EvalStateNode
extends Object

Superclass of all state nodes in an evaluation node tree representing an event expressions. Follows the Composite pattern. Subclasses are expected to keep their own collection containing child nodes as needed.


Constructor Summary
EvalStateNode(EvalNode factoryNode, Evaluator parentNode, Object stateObjectId)
          Constructor.
 
Method Summary
abstract  Object accept(EvalStateNodeVisitor visitor, Object data)
          Accept a visitor.
abstract  Object childrenAccept(EvalStateNodeVisitor visitor, Object data)
          Pass the visitor to all child nodes.
 EvalNode getFactoryNode()
          Returns the factory node for the state node.
 Evaluator getParentEvaluator()
          Returns the parent evaluator.
 Object getStateObjectId()
          Returns the state nodes object id.
abstract  void quit()
          Stops the event expression or an instance of it.
 void setParentEvaluator(Evaluator parentEvaluator)
          Sets the parent evaluator.
abstract  void start()
          Starts the event expression or an instance of it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvalStateNode

public EvalStateNode(EvalNode factoryNode,
                     Evaluator parentNode,
                     Object stateObjectId)
Constructor.

Parameters:
parentNode - is the evaluator for this node on which to indicate a change in truth value
factoryNode - is the factory node creating the state instance
stateObjectId - is the state object id assigned to state node
Method Detail

start

public abstract void start()
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.


quit

public abstract void quit()
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.


accept

public abstract Object accept(EvalStateNodeVisitor visitor,
                              Object data)
Accept a visitor. Child classes are expected to invoke the visit method on the visitor instance passed in.

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 abstract Object childrenAccept(EvalStateNodeVisitor visitor,
                                      Object data)
Pass the visitor to all child nodes.

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

getParentEvaluator

public final Evaluator getParentEvaluator()
Returns the parent evaluator.

Returns:
parent evaluator instance

getStateObjectId

public Object getStateObjectId()
Returns the state nodes object id.

Returns:
object id

getFactoryNode

public EvalNode getFactoryNode()
Returns the factory node for the state node.

Returns:
factory node

setParentEvaluator

public final void setParentEvaluator(Evaluator parentEvaluator)
Sets the parent evaluator.

Parameters:
parentEvaluator - for this node