org.d_haven.event.impl
public class DefaultPipe extends AbstractPipe
Nested Class Summary | |
---|---|
static class | DefaultPipe.DefaultPreparedEnqueue |
Field Summary | |
---|---|
List | m_elements |
protected int | m_reserve
The number of reserve items. |
Constructor Summary | |
---|---|
DefaultPipe()
Create an unbounded DefaultPipe. | |
DefaultPipe(int size)
Construct a new DefaultPipe with the specified number of
elements. if the number of elements is greater than zero, then
the Pipe is bounded by that number. | |
DefaultPipe(EnqueuePredicate predicate)
Construct a new DefaultPipe with the supplied EnqueuePredicate.
|
Method Summary | |
---|---|
protected Object[] | doDequeue(int numElements) |
protected Object | doDequeue() |
protected Object[] | doDequeueAll() |
protected void | doEnqueue(Object[] elements) |
protected void | doEnqueue(Object element) |
protected PreparedEnqueue | doPrepareEnqueue(Object[] elements) |
static Object[] | retrieveElements(List buf, int count)
Removes the given number of elements from the given
buf and returns them in an array. |
int | size()
Return the number of elements currently in the
Pipe .
|
String | toString()
Get the string representation of this Pipe.
|
Pipe
is bounded by that number. Otherwise, the
Pipe
is not bounded at all.
Parameters: size The maximum number of elements in the
Pipe
. Any number less than 1 means there
is no limit.
Parameters: predicate the EnqueuePredicate to use
buf
and returns them in an array. Trusts the caller
to pass in a buffer full of Object
s and with at
least count
elements available.
Parameters: buf to remove elements from, the caller is responsible for synchronizing access count number of elements to remove/return
Returns: requested number of elements
Pipe
.
Returns: int
representing the number of elements
(including the reserved ones).
Returns: the string message