jsim.queue
Class LIFO_Queue

java.lang.Object
  extended by jsim.queue.Queue
      extended by jsim.queue.LIFO_Queue
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.List

public class LIFO_Queue
extends Queue

LIFO_Queue class implements the Last_In_First_Out queue (or stack).

Version:
1.0 96/06/20
Author:
John Miller, Zhiwei Zhang

Field Summary
 
Fields inherited from class jsim.queue.Queue
capacity, root, size
 
Constructor Summary
LIFO_Queue()
          Constructs an empty LIFO queue with unlimited capacity.
LIFO_Queue(int capacity)
          Constructs an empty LIFO queue with limited capacity.
 
Method Summary
 Q_Node addAt(java.lang.Object item)
          Insert an element into the queue.
 
Methods inherited from class jsim.queue.Queue
add, add, addAll, addAll, cancel, clear, contains, containsAll, first, get, indexOf, isEmpty, isFull, iterator, lastIndexOf, listIterator, listIterator, remove, remove, remove, removeAll, removeMin, retainAll, set, size, subList, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

LIFO_Queue

public LIFO_Queue()
Constructs an empty LIFO queue with unlimited capacity.


LIFO_Queue

public LIFO_Queue(int capacity)
Constructs an empty LIFO queue with limited capacity.

Parameters:
capacity - the maximum number of items queue can hold.
Method Detail

addAt

public Q_Node addAt(java.lang.Object item)
             throws FullQueueException
Insert an element into the queue.

Specified by:
addAt in class Queue
Parameters:
item - new item to be inserted
Returns:
Q_Node node holding new item
Throws:
FullQueueException - if the queue is full