Quadcap Embeddable Server

com.quadcap.util.collections.Queue Interface Reference

Inheritance diagram for com.quadcap.util.collections.Queue:

com.quadcap.util.collections.ArrayQueue List of all members.

Detailed Description

This class implements a queue with a capacity.

Author:
Stan Bailes

Definition at line 46 of file Queue.java.

Public Member Functions

void setCapacity (int capacity)
 Specify the maximum capacity of this queue, -1 means unbounded.

int size ()
 Return the number of items in the queue.

void addFront (Object obj)
 Add an object to the front of the queue.

void addBack (Object obj)
 Add an object to the back of the queue.

Object head ()
 Access the object at the front of the queue.

Object tail ()
 Access the object at the back of the queue.

Object popFront ()
 Remove and return the item at the front of the queue.

Object popBack ()
 Remove and return the item at the back of the queue.


Member Function Documentation

void com.quadcap.util.collections.Queue.addBack Object  obj  ) 
 

Add an object to the back of the queue.

Parameters:
obj the object to add

Implemented in com.quadcap.util.collections.ArrayQueue.

void com.quadcap.util.collections.Queue.addFront Object  obj  ) 
 

Add an object to the front of the queue.

Parameters:
obj the object to add

Implemented in com.quadcap.util.collections.ArrayQueue.

Object com.quadcap.util.collections.Queue.head  ) 
 

Access the object at the front of the queue.

Throw a runtime exception if the queue is empty.

Returns:
the item at the head of the queue

Implemented in com.quadcap.util.collections.ArrayQueue.

Object com.quadcap.util.collections.Queue.popBack  ) 
 

Remove and return the item at the back of the queue.

Throw a runtime exception if the queue is empty.

Returns:
the item at the tail of the queue

Implemented in com.quadcap.util.collections.ArrayQueue.

Object com.quadcap.util.collections.Queue.popFront  ) 
 

Remove and return the item at the front of the queue.

Throw a runtime exception if the queue is empty.

Returns:
the item at the head of the queue

Implemented in com.quadcap.util.collections.ArrayQueue.

void com.quadcap.util.collections.Queue.setCapacity int  capacity  ) 
 

Specify the maximum capacity of this queue, -1 means unbounded.

Parameters:
capacity the new capacity of the queue, or -1 to specify a queue of unlimited size.

Implemented in com.quadcap.util.collections.ArrayQueue.

int com.quadcap.util.collections.Queue.size  ) 
 

Return the number of items in the queue.

Returns:
the queue's size

Implemented in com.quadcap.util.collections.ArrayQueue.

Object com.quadcap.util.collections.Queue.tail  ) 
 

Access the object at the back of the queue.

Throw a runtime exception if the queue is empty.

Returns:
the item at the tail of the queue

Implemented in com.quadcap.util.collections.ArrayQueue.