|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.ircappender.impl.Fifo
public class Fifo
A first in, first out buffer. Note: This implementation is threadsafe with the only exception that you may end up with more elements than the limit in the queue.
| Field Summary | |
|---|---|
static int |
AUTOPOP
remove the oldest element if the fifo is full |
static int |
REFUSE
ignore the request to add more elements if the fifo is full |
| Constructor Summary | |
|---|---|
Fifo(int bufferSize,
int fullStrategy)
creates a new Fifo |
|
| Method Summary | |
|---|---|
void |
add(java.lang.String e)
adds an element. if the fifo is full either the oldest element is removed or the request to add this element is ignored, depending on fullStrategy |
boolean |
isEmpty()
is the fifo empty? |
java.lang.String |
pop()
gets the oldest element |
int |
size()
gets the current size of the fifo (this is the number of stored elements, not maximum size). |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int AUTOPOP
public static final int REFUSE
| Constructor Detail |
|---|
public Fifo(int bufferSize,
int fullStrategy)
bufferSize - the maximum size of the fifofullStrategy - what to do when the size limit is exceeded| Method Detail |
|---|
public void add(java.lang.String e)
e - element to addpublic boolean isEmpty()
true if the fifo is empty, false otherwise
public java.lang.String pop()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - in case the fifo is emptypublic int size()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||