All Packages Class Hierarchy This Package Previous Next Index
Class magician.Node.SchedQueue
java.lang.Object
|
+----magician.Node.SchedQueue
- public class SchedQueue
- extends Object
SchedQueue implements a simple queue mechanism. Allows for enumeration of the
elements.
-
head
-
-
length
-
-
tail
-
-
SchedQueue()
-
-
dequeue()
- Dequeue the oldest object on the queue.
-
dequeue(long)
- Dequeue the oldest object on the queue.
-
dump(String)
- writes objects to output with message
-
elements()
- Returns an enumeration of the elements in Last-In, First-Out
order.
-
enqueue(Object)
- Enqueue an object.
-
isEmpty()
- Is the queue empty?
-
reverseElements()
- Returns an enumeration of the elements in First-In, First-Out
order.
length
int length
head
QueueElement head
tail
QueueElement tail
SchedQueue
public SchedQueue()
enqueue
public synchronized void enqueue(Object obj)
- Enqueue an object.
- Parameters:
- obj - object to be queued
dequeue
public Object dequeue() throws InterruptedException
- Dequeue the oldest object on the queue. Will wait indefinitely.
- Returns:
- the oldest object on the queue.
- Throws: InterruptedException
- if operation is interrupted
dequeue
public synchronized Object dequeue(long timeOut) throws InterruptedException
- Dequeue the oldest object on the queue.
- Parameters:
- timeOut - the number of milliseconds to wait for something
to arrive.
- Returns:
- the oldest object on the queue.
- Throws: InterruptedException
- if operation is interrupted
isEmpty
public boolean isEmpty()
- Is the queue empty?
- Returns:
- true if the queue is empty.
elements
public final synchronized Enumeration elements()
- Returns an enumeration of the elements in Last-In, First-Out
order. Use the Enumeration methods on the returned object to
fetch the elements sequentially.
- Returns:
- an enumeration of objects in the queue
reverseElements
public final synchronized Enumeration reverseElements()
- Returns an enumeration of the elements in First-In, First-Out
order. Use the Enumeration methods on the returned object to
fetch the elements sequentially.
- Returns:
- an enumeration of objects in the queue
dump
public synchronized void dump(String msg)
- writes objects to output with message
- Parameters:
- msg - the message to prepended to output
All Packages Class Hierarchy This Package Previous Next Index