Class sun.server.misc.Queue
All Packages Class Hierarchy This Package Previous Next Index
Class sun.server.misc.Queue
java.lang.Object
|
+----sun.server.misc.Queue
- public class Queue
- extends Object
This class implements a simple queue.
-
data
- The queue data.
-
i
- Index of head and tail of queue, respectively.
-
j
- Index of head and tail of queue, respectively.
-
len
- Current number of items in the queue.
-
Queue(int)
- Creates a queue with the specified size.
-
add(Object)
- Adds an item to the queue.
-
empty()
- Returns true if the queue is empty.
-
full()
- Returns true if the queue is full.
-
remove()
- Removes an item from the queue.
data
protected Object data[]
- The queue data.
i
protected int i
- Index of head and tail of queue, respectively.
j
protected int j
- Index of head and tail of queue, respectively.
len
protected int len
- Current number of items in the queue.
Queue
public Queue(int size)
- Creates a queue with the specified size.
add
public synchronized void add(Object obj) throws QueueFullException
- Adds an item to the queue.
- Parameters:
- obj - the object to be added to the head of the queue
- Throws: QueueFullException
- If the queue is full.
remove
public synchronized Object remove() throws QueueEmptyException
- Removes an item from the queue.
- Returns:
- the object removed from the tail of the queue
- Throws: QueueEmptyException
- If the queue is empty.
empty
public synchronized boolean empty()
- Returns true if the queue is empty.
full
public synchronized boolean full()
- Returns true if the queue is full.
All Packages Class Hierarchy This Package Previous Next Index