UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.collection
Interface Queue

All Known Implementing Classes:
QueueDynamicSize, QueueFixedSize

public interface Queue

An interface for a Queue.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Nov 21 1997, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
1.1.4
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
(jasonh@cs.berkeley.edu)

Method Summary
 int capacity()
          Get the current maximum capacity of the queue.
 void clear()
          Clears out all elements in the Queue.
 Object dequeue()
          Remove and return the first element in the queue.
 void enqueue(Object obj)
          Add an element to the end of the queue.
 boolean isEmpty()
          Checks if the queue is empty.
 boolean isFull()
          Check if the queue is full.
 Object peek()
          Return the first element in the queue without removing it.
 int size()
          Gets the size of the queue (the current number of elements in the queue).
 

Method Detail

peek

public Object peek()
Return the first element in the queue without removing it.
Returns:
An object representing the first element in the queue, null if empty.

isEmpty

public boolean isEmpty()
Checks if the queue is empty.
Returns:
true if the queue is empty, false otherwise

isFull

public boolean isFull()
Check if the queue is full.
Returns:
Returns the status of the queue (full or not).

size

public int size()
Gets the size of the queue (the current number of elements in the queue).
Returns:
An int representing the current number of elements in the queue.

capacity

public int capacity()
Get the current maximum capacity of the queue.
Returns:
an int representing the current maximum capacity of the queue.

clear

public void clear()
Clears out all elements in the Queue.

enqueue

public void enqueue(Object obj)
             throws FullException
Add an element to the end of the queue.
Parameters:
o - is the Object to add to the queue.
Throws:
QueueFullException - if the queue is full

dequeue

public Object dequeue()
               throws EmptyException
Remove and return the first element in the queue.
Returns:
An object representing the first element in the queue
Throws:
QueueEmptyException - if the Queue is empty

Copyright Information