net.esper.eql.join.table
Class PropertyIndexedEventTable

java.lang.Object
  extended by net.esper.eql.join.table.PropertyIndexedEventTable
All Implemented Interfaces:
EventTable

public class PropertyIndexedEventTable
extends java.lang.Object
implements EventTable

Index that organizes events by the event property values into hash buckets. Based on a HashMap with MultiKeyUntyped keys that store the property values. Takes a list of property names as parameter. Doesn't care which event type the events have as long as the properties exist. If the same event is added twice, the class throws an exception on add.


Constructor Summary
PropertyIndexedEventTable(int streamNum, EventType eventType, java.lang.String[] propertyNames)
          Ctor.
 
Method Summary
 void add(EventBean[] events)
          Add an array of events.
 java.util.Set<EventBean> lookup(java.lang.Object[] keys)
          Returns the set of events that have the same property value as the given event.
 void remove(EventBean[] events)
          Remove events.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyIndexedEventTable

public PropertyIndexedEventTable(int streamNum,
                                 EventType eventType,
                                 java.lang.String[] propertyNames)
Ctor.

Parameters:
streamNum - - the stream number that is indexed
eventType - - types of events indexed
propertyNames - - property names to use for indexing
Method Detail

add

public void add(EventBean[] events)
Add an array of events. Same event instance is not added twice. Event properties should be immutable. Allow null passed instead of an empty array.

Specified by:
add in interface EventTable
Parameters:
events - to add
Throws:
java.lang.IllegalArgumentException - if the event was already existed in the index

remove

public void remove(EventBean[] events)
Remove events.

Specified by:
remove in interface EventTable
Parameters:
events - to be removed, can be null instead of an empty array.
Throws:
java.lang.IllegalArgumentException - when the event could not be removed as its not in the index

lookup

public java.util.Set<EventBean> lookup(java.lang.Object[] keys)
Returns the set of events that have the same property value as the given event.

Parameters:
keys - to compare against
Returns:
set of events with property value, or null if none found (never returns zero-sized set)

toString

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