net.esper.filter
Class EventTypeIndex

java.lang.Object
  extended by net.esper.filter.EventTypeIndex
All Implemented Interfaces:
EventEvaluator

public class EventTypeIndex
extends Object
implements EventEvaluator

Mapping of event type to a tree-like structure containing filter parameter constants in indexes FilterParamIndex and filter callbacks in FilterCallbackSetNode.

This class evaluates events for the purpose of filtering by (1) looking up the event's EventType and (2) asking the subtree for this event type to evaluate the event.

The class performs all the locking required for multithreaded access.


Constructor Summary
EventTypeIndex()
          Constructor.
 
Method Summary
 void add(EventType eventType, FilterCallbackSetNode rootNode)
          Add a new event type to the index and use the specified node for the root node of its subtree.
 FilterCallbackSetNode get(EventType eventType)
          Returns the root node for the given event type, or null if this event type has not been seen before.
 void matchEvent(EventBean event, List<FilterCallback> matches)
          Perform the matching of an event based on the event property values, adding any callbacks for matches found to the matches list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventTypeIndex

public EventTypeIndex()
Constructor.

Method Detail

add

public void add(EventType eventType,
                FilterCallbackSetNode rootNode)
Add a new event type to the index and use the specified node for the root node of its subtree. If the event type already existed, the method will throw an IllegalStateException.

Parameters:
eventType - is the event type to be added to the index
rootNode - is the root node of the subtree for filter constant indizes and callbacks

get

public FilterCallbackSetNode get(EventType eventType)
Returns the root node for the given event type, or null if this event type has not been seen before.

Parameters:
eventType - is an event type
Returns:
the subtree's root node

matchEvent

public void matchEvent(EventBean event,
                       List<FilterCallback> matches)
Description copied from interface: EventEvaluator
Perform the matching of an event based on the event property values, adding any callbacks for matches found to the matches list.

Specified by:
matchEvent in interface EventEvaluator
Parameters:
event - is the event object wrapper to obtain event property values from
matches - accumulates the matching filter callbacks