org.freecompany.util.core
Class RingBuffer<T>

java.lang.Object
  extended by org.freecompany.util.core.RingBuffer<T>
All Implemented Interfaces:
java.lang.Iterable<T>

public class RingBuffer<T>
extends java.lang.Object
implements java.lang.Iterable<T>


Field Summary
protected  T[] array
           
protected  int read
           
protected  int size
           
protected  int write
           
 
Constructor Summary
RingBuffer(int capacity)
           
 
Method Summary
 void add(T type)
           
 java.util.Iterator<T> iterator()
           
 T remove()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

array

protected final T[] array

size

protected int size

read

protected int read

write

protected int write
Constructor Detail

RingBuffer

public RingBuffer(int capacity)
Method Detail

add

public void add(T type)

remove

public T remove()

size

public int size()

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>