jsim.jmodel
Class QueueSet

java.lang.Object
  extended by jsim.jmodel.QueueSet

public class QueueSet
extends java.lang.Object

The QueueSet class inserts and removes items in FIFO order, but also provides an organaize method to eliminate duplicate items.


Constructor Summary
QueueSet(int size)
          Constructor for QueueSet.
 
Method Summary
 int dequeue()
          Remove the item at the front of the queue.
 void enqueue(int item)
          Insert an item on the back of the queue.
 int getFront()
          Get the item at the front of the queue.
 boolean isEmpty()
          Is the Queue Empty?
 boolean isFull()
          Is the Queue full?
 void organize()
          Organize the queue to generate the correct order for Generator.
 void reset()
          Reset the Queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueSet

public QueueSet(int size)
Constructor for QueueSet.

Parameters:
size - queue capacity
Method Detail

isEmpty

public boolean isEmpty()
Is the Queue Empty?

Returns:
boolean whether queue is empty

isFull

public boolean isFull()
Is the Queue full?

Returns:
boolean whether queue is full

organize

public void organize()
              throws java.lang.ArrayIndexOutOfBoundsException
Organize the queue to generate the correct order for Generator.

Throws:
java.lang.ArrayIndexOutOfBoundsException - out of bounds

enqueue

public void enqueue(int item)
             throws java.lang.ArrayIndexOutOfBoundsException
Insert an item on the back of the queue.

Parameters:
item - item to be added
Throws:
java.lang.ArrayIndexOutOfBoundsException - out of bounds

dequeue

public int dequeue()
            throws java.lang.ArrayIndexOutOfBoundsException
Remove the item at the front of the queue.

Returns:
int first item
Throws:
java.lang.ArrayIndexOutOfBoundsException - out of bounds

getFront

public int getFront()
             throws java.lang.ArrayIndexOutOfBoundsException
Get the item at the front of the queue.

Returns:
int first item
Throws:
java.lang.ArrayIndexOutOfBoundsException - out of bounds

reset

public void reset()
Reset the Queue.