|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.collection.TimeWindow
public final class TimeWindow
Container for events per time slot. The time is provided as long milliseconds by client classes. Events are for a specified timestamp and the implementation creates and adds the event to a slot for that timestamp. Events can be expired from the window via the expireEvents method when their timestamp is before (or less then) an expiry timestamp passed in. Expiry removes the event from the window. The window allows iteration through its contents. It is assumed that the timestamp passed to the add method is ascending. The window is backed by a collection reflecting the timestamp order rather then any sorted map or linked hash map for performance reasons.
Constructor Summary | |
---|---|
TimeWindow(boolean isSupportRemoveStream)
Ctor. |
Method Summary | |
---|---|
void |
add(long timestamp,
EventBean bean)
Adds event to the time window for the specified timestamp. |
void |
adjust(long delta)
Adjust expiry dates. |
java.util.ArrayDeque<EventBean> |
expireEvents(long expireBefore)
Return and remove events in time-slots earlier (less) then the timestamp passed in, returning the list of events expired. |
java.lang.Long |
getOldestTimestamp()
Returns the oldest timestamp in the collection if there is at least one entry, else it returns null if the window is empty. |
java.util.Map<EventBean,TimeWindowPair> |
getReverseIndex()
Returns the reverse index, for testing purposes. |
java.util.ArrayDeque<TimeWindowPair> |
getWindow()
|
boolean |
isEmpty()
Returns true if the window is currently empty. |
java.util.Iterator<EventBean> |
iterator()
Returns event iterator. |
void |
remove(EventBean theEvent)
Removes the event from the window, if remove stream handling is enabled. |
void |
setReverseIndex(java.util.Map<EventBean,TimeWindowPair> reverseIndex)
|
void |
setWindow(java.util.ArrayDeque<TimeWindowPair> window,
int size)
|
void |
visitView(ViewDataVisitor viewDataVisitor,
DataWindowViewFactory viewFactory)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimeWindow(boolean isSupportRemoveStream)
isSupportRemoveStream
- true to indicate the time window should support effective removal of events
in the window based on the remove stream events received, or false to not accomodate removal at allMethod Detail |
---|
public void adjust(long delta)
delta
- delta to adjust forpublic final void add(long timestamp, EventBean bean)
timestamp
- - the time slot for the eventbean
- - event to addpublic final void remove(EventBean theEvent)
theEvent
- to removepublic final java.util.ArrayDeque<EventBean> expireEvents(long expireBefore)
expireBefore
- is the timestamp from which on to keep events in the window
public final java.util.Iterator<EventBean> iterator()
iterator
in interface java.lang.Iterable
public final java.lang.Long getOldestTimestamp()
public final boolean isEmpty()
public java.util.Map<EventBean,TimeWindowPair> getReverseIndex()
public java.util.ArrayDeque<TimeWindowPair> getWindow()
public void setWindow(java.util.ArrayDeque<TimeWindowPair> window, int size)
public void setReverseIndex(java.util.Map<EventBean,TimeWindowPair> reverseIndex)
public void visitView(ViewDataVisitor viewDataVisitor, DataWindowViewFactory viewFactory)
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |