net.sf.zig_project.gpl.common.queue
Interface Queue

All Known Subinterfaces:
ConsistantQueue, GenericBlockingQueue, GenericQueue, LinearQueue, OrderedBlockingQueue, OrderedQueue, SealableQueue
All Known Implementing Classes:
ArrayQueueTest.CheckedArrayQueue, LinearDispatchQueue, LinearOrderedQueue, LinearQueueBase, LinearQueueTest.CheckedDuplexQueue, LinearQueueTest.CheckedFifoQueue, PriorityQueue, PriorityQueueBase

public interface Queue

Implementations of the Queue class are encouraged to provide efficient implementations of standard queue operations.

Implementing classes of this interface are designed to be more robust than uses for Java's Collections framework when applied as queues. Further, they are somewhat more versatile than the Queue interface introduced in Java 5.0. This interface was origionally introduced prior to Java 5.0, but users will need to be wary that using import java.util.* could cause an ambiguity error.

Version:
October 9, 2004
Author:
Frank Ziglar

Method Summary
 void clear()
          Empties the Queue.
 boolean contains(Object o)
          Determines if the Queue contains a copy of the specified Object.
 Enumeration elements()
          Retrieves a list of the elements currently in the queue in a form suitable to enumerate over.
 boolean isEmpty()
          Determines if the Queue is empty.
 Object remove(Object o)
          Removes the first found element that is equal to o from the queue.
 

Method Detail

remove

public Object remove(Object o)
Removes the first found element that is equal to o from the queue.

Parameters:
o - a copy of the Object to be removed
Returns:
the first copy of o found, or null if no copy was found.

contains

public boolean contains(Object o)
Determines if the Queue contains a copy of the specified Object.

Parameters:
o - an Object to look for copies of
Returns:
true if at least one copy of o was found in the queue

isEmpty

public boolean isEmpty()
Determines if the Queue is empty. An empty queue contains no elements.

Returns:
true only if the Queue is empty

elements

public Enumeration elements()
Retrieves a list of the elements currently in the queue in a form suitable to enumerate over. Operations on the Enumeration after this queue has been modified are not anticipated, and may cause unforseen problems.

Returns:
an Enumeration of the elements in the queue

clear

public void clear()
Empties the Queue. All elements are cleared out, and the Queue will be empty after this call.