|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
org.jboss.util.collection.AbstractQueue
public abstract class AbstractQueue
An abstract implementation of a Queue. Sub-classes must provide methods
for addLast(Object)
and removeFirst()
.
Field Summary | |
---|---|
static int |
DEFAULT_MAXIMUM_SIZE
Default maximum queue size |
protected int |
maximumSize
Maximum queue size |
Fields inherited from interface org.jboss.util.collection.Queue |
---|
UNLIMITED_MAXIMUM_SIZE |
Constructor Summary | |
---|---|
protected |
AbstractQueue()
Initializes the AbstractQueue. |
protected |
AbstractQueue(int maxSize)
Initializes the AbstractQueue. |
Method Summary | |
---|---|
boolean |
add(Object obj)
Append and object to the underling list. |
protected abstract boolean |
addLast(Object obj)
Appends the given element to the end of the queue |
void |
clear()
Removes all of the elements from this queue |
int |
getMaximumSize()
Get the maximum size of the queue. |
boolean |
isEmpty()
Check if the queue is empty. |
boolean |
isFull()
Check if the queue is full. |
Object |
remove()
Remove and return the first object in the queue. |
protected abstract Object |
removeFirst()
Remove the first object in the queue |
void |
setMaximumSize(int size)
Set the maximum size of the queue |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jboss.util.collection.Queue |
---|
getBack, getFront |
Methods inherited from interface java.util.Collection |
---|
addAll, contains, containsAll, equals, hashCode, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Field Detail |
---|
public static int DEFAULT_MAXIMUM_SIZE
protected int maximumSize
Constructor Detail |
---|
protected AbstractQueue()
protected AbstractQueue(int maxSize)
maxSize
- Maximum queue size.
IllegalArgumentException
- Illegal size.Method Detail |
---|
public int getMaximumSize()
getMaximumSize
in interface Queue
Queue.UNLIMITED_MAXIMUM_SIZE
.public void setMaximumSize(int size)
setMaximumSize
in interface Queue
size
- New maximim queue size or Queue.UNLIMITED_MAXIMUM_SIZE
.
IllegalArgumentException
- Illegal size.public boolean isFull()
isFull
in interface Queue
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface Queue
isEmpty
in class AbstractCollection
public boolean add(Object obj) throws FullCollectionException
add
in interface Collection
add
in interface Queue
add
in class AbstractCollection
obj
- Object to enqueue.
FullCollectionException
- The queue is full.public Object remove() throws EmptyCollectionException
remove
in interface Queue
EmptyCollectionException
- The queue is empty.public void clear()
clear
in interface Collection
clear
in class AbstractCollection
protected abstract boolean addLast(Object obj)
obj
- Object to append
protected abstract Object removeFirst()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |