public class PriorEventBufferSingle extends Object implements ViewUpdatedCollection, RelativeAccessByEventNIndex
Buffers only exactly those events in new data and old data that are being asked for via the 2 or more 'prior' functions that specify different indexes. For example "select prior(2, price), prior(1, price)" results in on buffer instance handling both the need to the immediatly prior (1) and the 2-events-ago event (2).
As all views are required to post new data and post old data that removes the new data to subsequent views, this buffer can be attached to all views and should not result in a memory leak.
When the buffer receives old data (rstream) events it removes the prior events to the rstream events from the buffer the next time it receives a post (not immediatly) to allow queries to the buffer.
Constructor and Description |
---|
PriorEventBufferSingle(int priorEventIndex)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
De-allocate resources held by the collection.
|
RollingEventBuffer |
getNewEvents() |
int |
getNumEventsInsertBuf() |
Map<EventBean,EventBean> |
getPriorEventMap() |
EventBean |
getRelativeToEnd(int index) |
EventBean |
getRelativeToEvent(EventBean theEvent,
int priorToIndex)
Returns the prior event to the given event counting back the number of events as supplied by index.
|
Iterator<EventBean> |
getWindowToEvent() |
Collection<EventBean> |
getWindowToEventCollReadOnly() |
int |
getWindowToEventCount() |
void |
update(EventBean[] newData,
EventBean[] oldData)
Accepts view insert and remove stream.
|
void |
update(EventBean[] newData,
EventBean[] oldData,
PriorEventBufferChangeCaptureSingle captureSingle) |
public PriorEventBufferSingle(int priorEventIndex)
priorEventIndex
- is the number-of-events prior to the current event we are interested inpublic void update(EventBean[] newData, EventBean[] oldData)
ViewUpdatedCollection
update
in interface ViewUpdatedCollection
newData
- is the insert stream events or null if no dataoldData
- is the remove stream events or null if no datapublic void update(EventBean[] newData, EventBean[] oldData, PriorEventBufferChangeCaptureSingle captureSingle)
public EventBean getRelativeToEvent(EventBean theEvent, int priorToIndex)
RelativeAccessByEventNIndex
getRelativeToEvent
in interface RelativeAccessByEventNIndex
theEvent
- is the event to count back frompriorToIndex
- is the number of events to go backpublic EventBean getRelativeToEnd(int index)
getRelativeToEnd
in interface RelativeAccessByEventNIndex
public Iterator<EventBean> getWindowToEvent()
getWindowToEvent
in interface RelativeAccessByEventNIndex
public int getWindowToEventCount()
getWindowToEventCount
in interface RelativeAccessByEventNIndex
public Collection<EventBean> getWindowToEventCollReadOnly()
getWindowToEventCollReadOnly
in interface RelativeAccessByEventNIndex
public RollingEventBuffer getNewEvents()
public void destroy()
ViewUpdatedCollection
destroy
in interface ViewUpdatedCollection
public int getNumEventsInsertBuf()
getNumEventsInsertBuf
in interface ViewUpdatedCollection