com.espertech.esper.filter
Class FilterHandleSetNode

java.lang.Object
  extended by com.espertech.esper.filter.FilterHandleSetNode
All Implemented Interfaces:
EventEvaluator

public final class FilterHandleSetNode
extends java.lang.Object
implements EventEvaluator

This class holds a list of indizes storing filter constants in FilterParamIndexBase nodes and a set of FilterHandle. An instance of this class represents a leaf-node (no indizes stored, just filter callbacks) but can also be non-leaf (some indizes exist) in a filter evaluation tree. Events are evaluated by asking each of the indizes to evaluate the event and by adding any filter callbacks in this node to the "matches" list of callbacks.


Constructor Summary
FilterHandleSetNode(java.util.concurrent.locks.ReadWriteLock nodeRWLock)
          Constructor.
 
Method Summary
protected  void add(FilterHandle filterCallback)
          Add a filter callback.
protected  void add(FilterParamIndexBase index)
          Add an index.
protected  boolean contains(FilterHandle filterCallback)
          Returns an indication whether the filter callback exists in this node.
 java.util.Set<FilterHandle> getCallbackSet()
           
protected  int getFilterCallbackCount()
          Returns the number of filter callbacks stored.
 java.util.List<FilterParamIndexBase> getIndizes()
          Returns list of indexes - not returning an iterator.
protected  java.util.concurrent.locks.ReadWriteLock getNodeRWLock()
          Returns to lock to use for making changes to the filter callback or inzides collections stored by this node.
protected  boolean isEmpty()
          Returns an indication of whether there are any callbacks or index nodes at all in this set.
 void matchEvent(EventBean theEvent, java.util.Collection<FilterHandle> matches)
          Evaluate an event by asking each index to match the event.
protected  boolean remove(FilterHandle filterCallback)
          Remove a filter callback, returning true if it was found and removed or false if not in collection.
protected  boolean remove(FilterParamIndexBase index)
          Remove an index, returning true if it was found and removed or false if not in collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterHandleSetNode

public FilterHandleSetNode(java.util.concurrent.locks.ReadWriteLock nodeRWLock)
Constructor.

Method Detail

isEmpty

protected boolean isEmpty()
Returns an indication of whether there are any callbacks or index nodes at all in this set. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Returns:
true if there are neither indizes nor filter callbacks stored, false if either exist.

getFilterCallbackCount

protected int getFilterCallbackCount()
Returns the number of filter callbacks stored. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Returns:
number of filter callbacks stored

getNodeRWLock

protected final java.util.concurrent.locks.ReadWriteLock getNodeRWLock()
Returns to lock to use for making changes to the filter callback or inzides collections stored by this node.

Returns:
lock to use in multithreaded environment

getIndizes

public java.util.List<FilterParamIndexBase> getIndizes()
Returns list of indexes - not returning an iterator. Client classes should not change this collection.

Returns:
list of indizes

matchEvent

public final void matchEvent(EventBean theEvent,
                             java.util.Collection<FilterHandle> matches)
Evaluate an event by asking each index to match the event. Any filter callbacks at this node automatically match the event and do not need to be further evaluated, and are thus added to the "matches" list of callbacks. NOTE: This client should not use the lock before calling this method.

Specified by:
matchEvent in interface EventEvaluator
Parameters:
theEvent - is the event wrapper supplying the event property values
matches - is the list of callbacks to add to for any matches found

contains

protected boolean contains(FilterHandle filterCallback)
Returns an indication whether the filter callback exists in this node. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Parameters:
filterCallback - is the filter callback to check for
Returns:
true if callback found, false if not

add

protected final void add(FilterParamIndexBase index)
Add an index. The same index can be added twice - there is no checking done. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Parameters:
index - - index to add

remove

protected final boolean remove(FilterParamIndexBase index)
Remove an index, returning true if it was found and removed or false if not in collection. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Parameters:
index - is the index to remove
Returns:
true if found, false if not existing

add

protected final void add(FilterHandle filterCallback)
Add a filter callback. The filter callback set allows adding the same callback twice with no effect. If a client to the class needs to check that the callback already existed, the contains method does that. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Parameters:
filterCallback - is the callback to add

remove

protected final boolean remove(FilterHandle filterCallback)
Remove a filter callback, returning true if it was found and removed or false if not in collection. NOTE: the client to this method must use the read-write lock of this object to lock, if required by the client code.

Parameters:
filterCallback - is the callback to remove
Returns:
true if found, false if not existing

getCallbackSet

public java.util.Set<FilterHandle> getCallbackSet()

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