com.espertech.esper.collection
Class RollingEventBuffer

java.lang.Object
  extended by com.espertech.esper.collection.RollingEventBuffer

public class RollingEventBuffer
extends java.lang.Object

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
RollingEventBuffer(int size)
          Ctor.
 
Method Summary
 void add(EventBean theEvent)
          Add an event to the buffer.
 void add(EventBean[] events)
          Add events to the buffer.
 EventBean get(int index)
          Get an event prior to the last event posted given a number of events before the last.
 EventBean[] getBuffer()
           
 int getNextFreeIndex()
           
 int getSize()
           
 void setBuffer(EventBean[] buffer)
           
 void setNextFreeIndex(int nextFreeIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RollingEventBuffer

public RollingEventBuffer(int size)
Ctor.

Parameters:
size - is the maximum number of events in buffer
Method Detail

add

public void add(EventBean[] events)
Add events to the buffer.

Parameters:
events - to add

add

public void add(EventBean theEvent)
Add an event to the buffer.

Parameters:
theEvent - to add

get

public EventBean get(int index)
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

public EventBean[] getBuffer()

getNextFreeIndex

public int getNextFreeIndex()

setBuffer

public void setBuffer(EventBean[] buffer)

setNextFreeIndex

public void setNextFreeIndex(int nextFreeIndex)

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