|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectseda.sandStorm.core.FiniteQueue
The FiniteQueue class is a simple implementation of the QueueIF interface, using a linked list.
QueueIF
Constructor Summary | |
FiniteQueue()
Create a FiniteQueue with no enqueue predicate. |
|
FiniteQueue(EnqueuePredicateIF pred)
Create a FiniteQueue with the given enqueue predicate. |
|
FiniteQueue(java.lang.String name)
Create a FiniteQueue with no enqueue and the given name. |
Method Summary | |
QueueElementIF[] |
blocking_dequeue_all(int timeout_millis)
This method blocks on the queue up until a timeout occurs or until an element appears on the queue. |
QueueElementIF |
blocking_dequeue(int timeout_millis)
Just like blocking_dequeue_all, but returns only a single element. |
QueueElementIF[] |
blocking_dequeue(int timeout_millis,
int num)
This method blocks on the queue up until a timeout occurs or until an element appears on the queue. |
QueueElementIF[] |
blocking_dequeue(int timeout_millis,
int num,
boolean mustReturnNum)
|
QueueElementIF[] |
dequeue_all()
Dequeues all available elements, or returns null if there is
nothing left on the queue. |
QueueElementIF |
dequeue()
Dequeues the next element, or returns null if there is
nothing left on the queue. |
QueueElementIF[] |
dequeue(int num)
Dequeues at most num available elements, or returns
null if there is nothing left on the queue. |
QueueElementIF[] |
dequeue(int num,
boolean mustReturnNum)
|
void |
enqueue_abort(java.lang.Object key)
Abort a provisional enqueue. |
void |
enqueue_commit(java.lang.Object key)
Commit a provisional enqueue. |
boolean |
enqueue_lossy(QueueElementIF enqueueMe)
Enqueues the given element onto the queue. |
void |
enqueue_many(QueueElementIF[] enqueueMe)
Given an array of elements, atomically enqueues all of the elements in the array. |
java.lang.Object |
enqueue_prepare(QueueElementIF[] enqueueMe)
Provisionally enqueue the given elements. |
void |
enqueue(QueueElementIF enqueueMe)
Enqueues the given element onto the queue. |
EnqueuePredicateIF |
getEnqueuePredicate()
Return the enqueue predicate for this sink. |
int |
profileSize()
Return the profile size of the queue. |
void |
setEnqueuePredicate(EnqueuePredicateIF pred)
Set the enqueue predicate for this sink. |
int |
size()
Return the size of the queue. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FiniteQueue(EnqueuePredicateIF pred)
public FiniteQueue()
public FiniteQueue(java.lang.String name)
Method Detail |
public int size()
size
in interface SourceIF
public void enqueue(QueueElementIF enqueueMe) throws SinkFullException
SinkIF
enqueue
in interface SinkIF
enqueueMe
- The QueueElementIF
to enqueue
SinkFullException
- Indicates that the sink is temporarily full.public boolean enqueue_lossy(QueueElementIF enqueueMe)
SinkIF
enqueue_lossy
in interface SinkIF
enqueueMe
- The QueueElementIF
to enqueue
public void enqueue_many(QueueElementIF[] enqueueMe) throws SinkFullException
SinkIF
enqueue_many
in interface SinkIF
enqueueMe
- The element array to enqueue
SinkFullException
- Indicates that the sink is temporarily full.public QueueElementIF dequeue()
SourceIF
null
if there is
nothing left on the queue.
dequeue
in interface SourceIF
QueueElementIF
on the queuepublic QueueElementIF[] dequeue_all()
SourceIF
null
if there is
nothing left on the queue.
dequeue_all
in interface SourceIF
QueueElementIF
s on the queuepublic QueueElementIF[] dequeue(int num)
SourceIF
num
available elements, or returns
null
if there is nothing left on the queue.
dequeue
in interface SourceIF
num
QueueElementIF
s on the queuepublic QueueElementIF[] dequeue(int num, boolean mustReturnNum)
public QueueElementIF[] blocking_dequeue_all(int timeout_millis)
SourceIF
blocking_dequeue_all
in interface SourceIF
timeout_millis
- if timeout_millis is 0
, this method
will be non-blocking and will return right away, whether or not
any elements are pending on the queue. If timeout_millis is
-1
, this method blocks forever until something is
available. If timeout_millis is positive, this method will wait
about that number of milliseconds before returning, but possibly a
little more.
QueueElementIF
's. This array will
be null if no elements were pending.public QueueElementIF[] blocking_dequeue(int timeout_millis, int num, boolean mustReturnNum)
public QueueElementIF[] blocking_dequeue(int timeout_millis, int num)
SourceIF
num
elements waiting on the queue at that time.
blocking_dequeue
in interface SourceIF
public QueueElementIF blocking_dequeue(int timeout_millis)
SourceIF
blocking_dequeue
in interface SourceIF
public int profileSize()
profileSize
in interface ProfilableIF
public java.lang.Object enqueue_prepare(QueueElementIF[] enqueueMe) throws SinkException
enqueue_prepare
in interface SinkIF
enqueueMe
- The element array to provisionally enqueue
SinkException
enqueue_commit
,
enqueue_abort
public void enqueue_commit(java.lang.Object key)
enqueue_commit
in interface SinkIF
public void enqueue_abort(java.lang.Object key)
enqueue_abort
in interface SinkIF
public void setEnqueuePredicate(EnqueuePredicateIF pred)
setEnqueuePredicate
in interface SinkIF
public EnqueuePredicateIF getEnqueuePredicate()
getEnqueuePredicate
in interface SinkIF
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |