com.espertech.esper.pattern
Class EvalAndStateNode

java.lang.Object
  extended by com.espertech.esper.pattern.EvalStateNode
      extended by com.espertech.esper.pattern.EvalAndStateNode
All Implemented Interfaces:
Evaluator

public class EvalAndStateNode
extends EvalStateNode
implements Evaluator

This class represents the state of an "and" operator in the evaluation state tree.


Field Summary
protected  EvalStateNode[] activeChildNodes
           
protected  EvalAndNode evalAndNode
           
protected  java.lang.Object[] eventsPerChild
           
 
Constructor Summary
EvalAndStateNode(Evaluator parentNode, EvalAndNode evalAndNode)
          Constructor.
 
Method Summary
 void accept(EvalStateNodeVisitor visitor)
          Accept a visitor.
static void addMatchEvent(java.lang.Object[] eventsPerChild, int indexFrom, MatchedEventMap matchEvent)
           
 void evaluateFalse(EvalStateNode fromNode, boolean restartable)
          Indicate a change in truth value to false.
 void evaluateTrue(MatchedEventMap matchEvent, EvalStateNode fromNode, boolean isQuitted)
          Indicate a change in truth value to true.
protected static void generateMatchEvents(java.util.ArrayList<java.util.List<MatchedEventMap>> eventList, int index, java.util.List<MatchedEventMap> result, MatchedEventMap matchEvent)
          For each combination of MatchedEventMap instance in all collections, add an entry to the list.
static java.util.List<MatchedEventMap> generateMatchEvents(MatchedEventMap matchEvent, java.lang.Object[] eventsPerChild, int indexFrom)
          Generate a list of matching event combinations constisting of the events per child that are passed in.
 EvalNode getFactoryNode()
          Returns the factory node for the state node.
 boolean isFilterChildNonQuitting()
           
 boolean isFilterStateNode()
           
 boolean isNotOperator()
           
 boolean isObserverStateNodeNonRestarting()
           
 void quit()
          Stops the event expression or an instance of it.
 void removeMatch(java.util.Set<EventBean> matchEvent)
          Remove matches that overlap with the provided events.
 void start(MatchedEventMap beginState)
          Starts the event expression or an instance of it.
 java.lang.String toString()
           
 
Methods inherited from class com.espertech.esper.pattern.EvalStateNode
getParentEvaluator, setParentEvaluator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

evalAndNode

protected final EvalAndNode evalAndNode

activeChildNodes

protected final EvalStateNode[] activeChildNodes

eventsPerChild

protected java.lang.Object[] eventsPerChild
Constructor Detail

EvalAndStateNode

public EvalAndStateNode(Evaluator parentNode,
                        EvalAndNode evalAndNode)
Constructor.

Parameters:
parentNode - is the parent evaluator to call to indicate truth value
evalAndNode - is the factory node associated to the state
Method Detail

removeMatch

public void removeMatch(java.util.Set<EventBean> matchEvent)
Description copied from class: EvalStateNode
Remove matches that overlap with the provided events.

Specified by:
removeMatch in class EvalStateNode
Parameters:
matchEvent - set of events to check for

getFactoryNode

public EvalNode getFactoryNode()
Description copied from class: EvalStateNode
Returns the factory node for the state node.

Specified by:
getFactoryNode in class EvalStateNode
Returns:
factory node

start

public final void start(MatchedEventMap beginState)
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

isFilterStateNode

public boolean isFilterStateNode()
Specified by:
isFilterStateNode in class EvalStateNode

isNotOperator

public boolean isNotOperator()
Specified by:
isNotOperator in class EvalStateNode

isFilterChildNonQuitting

public boolean isFilterChildNonQuitting()
Specified by:
isFilterChildNonQuitting in interface Evaluator

isObserverStateNodeNonRestarting

public boolean isObserverStateNodeNonRestarting()
Specified by:
isObserverStateNodeNonRestarting in class EvalStateNode

evaluateTrue

public final void evaluateTrue(MatchedEventMap matchEvent,
                               EvalStateNode fromNode,
                               boolean isQuitted)
Description copied from interface: Evaluator
Indicate a change in truth value to true.

Specified by:
evaluateTrue in interface Evaluator
Parameters:
matchEvent - is the container for events that caused the change in truth value
fromNode - is the node that indicates the change
isQuitted - is an indication of whether the node continues listenening or stops listening

evaluateFalse

public final void evaluateFalse(EvalStateNode fromNode,
                                boolean restartable)
Description copied from interface: Evaluator
Indicate a change in truth value to false.

Specified by:
evaluateFalse in interface Evaluator
Parameters:
fromNode - is the node that indicates the change

generateMatchEvents

public static java.util.List<MatchedEventMap> generateMatchEvents(MatchedEventMap matchEvent,
                                                                  java.lang.Object[] eventsPerChild,
                                                                  int indexFrom)
Generate a list of matching event combinations constisting of the events per child that are passed in.

Parameters:
matchEvent - can be populated with prior events that must be passed on
eventsPerChild - is the list of events for each child node to the "And" node.
Returns:
list of events populated with all possible combinations

generateMatchEvents

protected static void generateMatchEvents(java.util.ArrayList<java.util.List<MatchedEventMap>> eventList,
                                          int index,
                                          java.util.List<MatchedEventMap> result,
                                          MatchedEventMap matchEvent)
For each combination of MatchedEventMap instance in all collections, add an entry to the list. Recursive method.

Parameters:
eventList - is an array of lists containing MatchedEventMap instances to combine
index - is the current index into the array
result - is the resulting list of MatchedEventMap
matchEvent - is the start MatchedEventMap to generate from

quit

public 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 void accept(EvalStateNodeVisitor visitor)
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

toString

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

addMatchEvent

public static void addMatchEvent(java.lang.Object[] eventsPerChild,
                                 int indexFrom,
                                 MatchedEventMap matchEvent)

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com