stockportfolio
Interface IQueue

All Known Subinterfaces:
IDQueue
All Known Implementing Classes:
ObjectDQueue

public interface IQueue

Interface for a queue of objects. It is an error for the queue to contain null. Concrete classes should include at least a zero-argument constructor which creates an empty queue.


Method Summary
 java.lang.Object dequeue()
          Remove an object from the queue.
 boolean enqueue(java.lang.Object newValue)
          Push a new object on the queue.
 java.lang.Object front()
          Look at the front of the queue.
 boolean isEmpty()
          Tell whether the queue is empty.
 boolean isFull()
          Tell whether the queue is full.
 int size()
          Tells how many objects are currently in the queue.
 

Method Detail

enqueue

public boolean enqueue(java.lang.Object newValue)
Push a new object on the queue.

Parameters:
newValue - a non-null object
Returns:
true iff the operation succeeded. In this case, the newValue is now the top of the queue and the previous top is just below it; the size of the queue has increased by 1.
Throws:
java.lang.IllegalArgumentException - if the new value is null.

dequeue

public java.lang.Object dequeue()
Remove an object from the queue.

Returns:
a reference to the front of the queue, or null if the queue is empty. The size of the queue has decreased by 1. Note that the reference is to the actual enqueued object, not to a clone.

front

public java.lang.Object front()
Look at the front of the queue. The queue itself is unchanged.

Returns:
the front of the queue, or null if the queue is empty. Note that the reference is to the actual enqueued object, not to a clone.

isEmpty

public boolean isEmpty()
Tell whether the queue is empty.

Returns:
true iff the queue is empty (has size 0).

isFull

public boolean isFull()
Tell whether the queue is full.

Returns:
true iff the queue is full, i.e., whether it is possible to another another object to it.

size

public int size()
Tells how many objects are currently in the queue.

Returns:
the number of objects in the queue, always >= 0