站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

AbstractQueue (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util.collection
Class AbstractQueue

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byorg.jboss.util.collection.AbstractQueue
All Implemented Interfaces:
Collection, Queue
Direct Known Subclasses:
ListQueue

public abstract class AbstractQueue
extends AbstractCollection
implements Queue

An abstract implementation of a Queue. Sub-classes must provide methods for addLast(Object) and removeFirst().

Version:
$Revision: 1.1 $
Author:
Jason Dillon

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

DEFAULT_MAXIMUM_SIZE

public static int DEFAULT_MAXIMUM_SIZE
Default maximum queue size


maximumSize

protected int maximumSize
Maximum queue size

Constructor Detail

AbstractQueue

protected AbstractQueue()
Initializes the AbstractQueue.


AbstractQueue

protected AbstractQueue(int maxSize)
Initializes the AbstractQueue.

Parameters:
maxSize - Maximum queue size.
Throws:
IllegalArgumentException - Illegal size.
Method Detail

getMaximumSize

public int getMaximumSize()
Get the maximum size of the queue.

Specified by:
getMaximumSize in interface Queue
Returns:
Maximum queue size or Queue.UNLIMITED_MAXIMUM_SIZE.

setMaximumSize

public void setMaximumSize(int size)
Set the maximum size of the queue

Specified by:
setMaximumSize in interface Queue
Parameters:
size - New maximim queue size or Queue.UNLIMITED_MAXIMUM_SIZE.
Throws:
IllegalArgumentException - Illegal size.

isFull

public boolean isFull()
Check if the queue is full.

Specified by:
isFull in interface Queue
Returns:
True if the queue is full.

isEmpty

public boolean isEmpty()
Check if the queue is empty.

Specified by:
isEmpty in interface Queue
Returns:
True if the queue is empty.

add

public boolean add(Object obj)
            throws FullCollectionException
Append and object to the underling list.

Specified by:
add in interface Queue
Parameters:
obj - Object to enqueue.
Returns:
True if collection was modified.
Throws:
FullCollectionException - The queue is full.

remove

public Object remove()
              throws EmptyCollectionException
Remove and return the first object in the queue.

Specified by:
remove in interface Queue
Returns:
Dequeued object.
Throws:
EmptyCollectionException - The queue is empty.

clear

public void clear()
Removes all of the elements from this queue

Specified by:
clear in interface Collection

addLast

protected abstract boolean addLast(Object obj)
Appends the given element to the end of the queue

Parameters:
obj - Object to append
Returns:
Per Collection.add(), we return a boolean to indicate if the object modified the collection.

removeFirst

protected abstract Object removeFirst()
Remove the first object in the queue

Returns:
First object in the queue


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.