net.hivecell.hive.support
Class ImageRingBuffer

java.lang.Object
  |
  +--net.hivecell.hive.support.ImageRingBuffer

public class ImageRingBuffer
extends java.lang.Object
implements java.io.Serializable

This class is a fixed size data structure that contains serializable images. If the ringbuffer is full and a new image is added, the least recently added image is removed.

See Also:
Serialized Form

Field Summary
protected  int highval
          The index of the most recent image in the buffer.
protected  SerializableImage[] store
          The array where the images are stored.
 
Constructor Summary
ImageRingBuffer(int size)
          Constructs a ImageRingBuffer of size;
 
Method Summary
 int addElement(SerializableImage si)
          Add an image to the buffer and return the index it was assigned.
 boolean containsIndex(int index)
          return whether the RingBuffer contains this index
 int getEarliestIndex()
          Get the index of the earliest image still in the buffer
 SerializableImage getElement(int i)
          Return the element with index i.
 int getLatestIndex()
          Get the index of the most recent image.
 int getSize()
          Get the size of the ringbuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

highval

protected int highval
The index of the most recent image in the buffer.

store

protected SerializableImage[] store
The array where the images are stored.
Constructor Detail

ImageRingBuffer

public ImageRingBuffer(int size)
Constructs a ImageRingBuffer of size;
Method Detail

getSize

public int getSize()
Get the size of the ringbuffer.

getLatestIndex

public int getLatestIndex()
Get the index of the most recent image.

getEarliestIndex

public int getEarliestIndex()
Get the index of the earliest image still in the buffer

containsIndex

public boolean containsIndex(int index)
return whether the RingBuffer contains this index

getElement

public SerializableImage getElement(int i)
Return the element with index i. If it is not in the buffer return null.

addElement

public int addElement(SerializableImage si)
Add an image to the buffer and return the index it was assigned.