28import java.io.PrintStream;
50 public void dump(PrintStream stream, String prefix);
75 public void resetFull(T[] copyFrom)
throws IllegalArgumentException;
159 public
boolean putSame(
boolean blocking) throws InterruptedException;
178 public
void growEmptyBuffer(T[] newElements) throws IllegalStateException, IllegalArgumentException;
191 public
void growFullBuffer(
int amount) throws IllegalStateException, IllegalArgumentException;
Ring buffer interface, a.k.a circular buffer.
void waitForFreeSlots(int count)
Blocks until at least count free slots become available.
void putBlocking(T e)
Enqueues the given element.
int size()
Returns the number of elements in this ring buffer.
int getFreeSlots()
Returns the number of free slots available to put.
T getBlocking()
Dequeues the oldest enqueued element.
void dump(PrintStream stream, String prefix)
Debug functionality - Dumps the contents of the internal array.
boolean putSame(boolean blocking)
Enqueues the same element at it's write position, if not full.
String toString()
Returns a short string representation incl.
void resetFull(T[] copyFrom)
Resets the read and write position according to a full ring buffer and fill all slots w/ elements of ...
int capacity()
Returns the net capacity of this ring buffer.
boolean isEmpty()
Returns true if this ring buffer is empty, otherwise false.
boolean put(T e)
Enqueues the given element.
void clear()
Resets the read and write position according to an empty ring buffer and set all ring buffer slots to...
T peek()
Peeks the next element at the read position w/o modifying pointer, nor blocking.
boolean isFull()
Returns true if this ring buffer is full, otherwise false.
void growEmptyBuffer(T[] newElements)
Grows an empty ring buffer, increasing it's capacity about the amount.
T peekBlocking()
Peeks the next element at the read position w/o modifying pointer, but w/ blocking.
void growFullBuffer(int amount)
Grows a full ring buffer, increasing it's capacity about the amount.