Class RollingEventBuffer
java.lang.Object
com.espertech.esper.common.internal.collection.RollingEventBuffer
Event buffer of a given size provides a random access API into the most current event to prior events
up to the given size. Oldest events roll out of the buffer first.
Backed by a fixed-size array that is filled forward, then rolls back to the beginning keeping track of the current position.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an event to the buffer.void
Add events to the buffer.get
(int index) Get an event prior to the last event posted given a number of events before the last.int
int
getSize()
void
void
setNextFreeIndex
(int nextFreeIndex)
-
Constructor Details
-
RollingEventBuffer
public RollingEventBuffer(int size) Ctor.- Parameters:
size
- is the maximum number of events in buffer
-
-
Method Details
-
add
Add events to the buffer.- Parameters:
events
- to add
-
add
Add an event to the buffer.- Parameters:
theEvent
- to add
-
get
Get an event prior to the last event posted given a number of events before the last.Thus index 0 returns the last event added, index 1 returns the prior to the last event added up to the maximum buffer size.
- Parameters:
index
- prior event index from zero to max size- Returns:
- prior event at given index
-
getSize
public int getSize() -
getBuffer
-
getNextFreeIndex
public int getNextFreeIndex() -
setBuffer
-
setNextFreeIndex
public void setNextFreeIndex(int nextFreeIndex)
-