Package org.jboss.util.collection
Interface Queue<E>
-
- Type Parameters:
E- the element type
- All Superinterfaces:
java.util.Collection<E>,java.lang.Iterable<E>
- All Known Implementing Classes:
AbstractQueue,ListQueue
public interface Queue<E> extends java.util.Collection<E>An iterface used to implement a first-in, first-out container.- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description static intUNLIMITED_MAXIMUM_SIZEUnlimited maximum queue size identifier.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanadd(E obj)Enqueue an object onto the queue.EgetBack()Get the object at the back of the queue.EgetFront()Get the object at the front of the queue.intgetMaximumSize()Get the maximum size of the queue.booleanisEmpty()Check if the queue is empty.booleanisFull()Check if the queue is full.Eremove()Dequeue an object from the queue.voidsetMaximumSize(int size)Set the maximum size of the queue.
-
-
-
Field Detail
-
UNLIMITED_MAXIMUM_SIZE
static final int UNLIMITED_MAXIMUM_SIZE
Unlimited maximum queue size identifier.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMaximumSize
int getMaximumSize()
Get the maximum size of the queue.- Returns:
- Maximum pool size or
UNLIMITED_MAXIMUM_SIZE.
-
setMaximumSize
void setMaximumSize(int size) throws java.lang.IllegalArgumentExceptionSet the maximum size of the queue.- Parameters:
size- New maximim pool size orUNLIMITED_MAXIMUM_SIZE.- Throws:
java.lang.IllegalArgumentException- Illegal size.
-
isFull
boolean isFull()
Check if the queue is full.- Returns:
- True if the queue is full.
-
isEmpty
boolean isEmpty()
Check if the queue is empty.- Specified by:
isEmptyin interfacejava.util.Collection<E>- Returns:
- True if the queue is empty.
-
add
boolean add(E obj) throws FullCollectionException
Enqueue an object onto the queue.- Specified by:
addin interfacejava.util.Collection<E>- Parameters:
obj- Object to enqueue.- Returns:
- True if collection was modified.
- Throws:
FullCollectionException- The queue is full.
-
remove
E remove() throws EmptyCollectionException
Dequeue an object from the queue.- Returns:
- Dequeued object.
- Throws:
EmptyCollectionException- The queue is empty.
-
getFront
E getFront() throws EmptyCollectionException
Get the object at the front of the queue.- Returns:
- Object at the front of the queue.
- Throws:
EmptyCollectionException- The queue is empty.
-
getBack
E getBack() throws EmptyCollectionException
Get the object at the back of the queue.- Returns:
- Object at the back of the queue.
- Throws:
EmptyCollectionException- The queue is empty.
-
-