|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.qfs.lib.util.RingBuffer
A simple thread-safe FIFO buffer that stores Objects in an array. If the buffer overflows old Objects are dropped. To pop all Objects from the RingBuffer you can either synchronize on the RingBuffer object - which is deadlock prone - or call popAll.
Constructor Summary | |
RingBuffer(int size)
Create a new RingBuffer. |
Method Summary | |
int |
getMaxSize()
Get the total size of the RingBuffer. |
java.lang.Object |
pop()
Pop an object from the back of the buffer. |
java.lang.Object[] |
popAll()
Pop all objects from the RingBuffer. |
void |
push(java.lang.Object object)
Push an Object to the front of the buffer. |
void |
setMaxSize(int newsize)
Set the total size of the RingBuffer. |
int |
size()
Get the number of Objects stored in the RingBuffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RingBuffer(int size)
size
- The size of the buffer.Method Detail |
public void push(java.lang.Object object)
object
- The object to push.public java.lang.Object pop() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- If the buffer is empty.public java.lang.Object[] popAll()
public int size()
public int getMaxSize()
public void setMaxSize(int newsize)
newsize
- The total size to set.
|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |