jAER project on SourceForge

net.sf.jaer.eventprocessing.tracking
Class LIFOEventBuffer<E extends BasicEvent>

java.lang.Object
  extended by net.sf.jaer.eventprocessing.tracking.LIFOEventBuffer<E>
All Implemented Interfaces:
java.lang.Iterable<E>

public final class LIFOEventBuffer<E extends BasicEvent>
extends java.lang.Object
implements java.lang.Iterable<E>

A circular buffer of events with methods for adding new events and getting back old ones in the order of addition, last in is first out.

Author:
tobi delbruck

Constructor Summary
LIFOEventBuffer(E[] array)
          Make a new instance of LIFOPolarityEventBuffer
 
Method Summary
 void add(E e)
          Adds an event to the end of the list.
 int capacity()
          Returns the capacity
 void clear()
          Resets the pointers and empties the size
 java.util.Iterator<E> iterator()
          Returns the iterator over events.
 int size()
          Returns the number of events presently stored.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LIFOEventBuffer

public LIFOEventBuffer(E[] array)
Make a new instance of LIFOPolarityEventBuffer

Parameters:
array - the array of objects holding the events
Method Detail

toString

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

add

public final void add(E e)
Adds an event to the end of the list. The iterator will iterate over the list, starting with this most-recently addeed event.

Parameters:
e - the event

clear

public void clear()
Resets the pointers and empties the size


size

public int size()
Returns the number of events presently stored.

Returns:
the number of events

capacity

public int capacity()
Returns the capacity

Returns:
the capacity

iterator

public final java.util.Iterator<E> iterator()
Returns the iterator over events. This iterator starts with the most recently added event and ends with the first event added or with the capacity event if more have been added than the buffer's capacity.

Specified by:
iterator in interface java.lang.Iterable<E extends BasicEvent>
Returns:
an iterator that can iterate over past events. Starts with most recently added event.

jAER project on SourceForge