code.space
Class Queue

java.lang.Object
  extended by code.space.Queue

public class Queue
extends java.lang.Object

Queue of the computations in the narrowing space. The queue is circular, i.e., every time the first element in the queue is processed, it is placed back into the queue.

Since:
Dec 20, 2000
Author:
Sergio Antoy

Nested Class Summary
 class Queue.UnderflowException
           
 
Field Summary
private  int first
          Index of element last requested (was first) in the queue.
private  java.util.Vector vector
          Vector holding the computations in the queue.
 
Constructor Summary
Queue()
           
 
Method Summary
 Computation dequeue()
          Take out the last returned (was first) computation of the queue.
 java.util.Enumeration elements()
          Return an enumeration of the computations in this queue.
 void enqueue(Computation computation)
          Place a computation in the queue.
 int first()
          This is needed by the pre and post debugging choice and narrow instructions to see all of the computations that were created by the choice or narrow instruction.
 Computation next()
          Return the first computation in the queue.
 Computation remove(Computation c)
           
 int size()
          Return the number of computations in the queue.
 java.lang.String toString()
          Return a printable representation of this queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vector

private java.util.Vector vector
Vector holding the computations in the queue.


first

private int first
Index of element last requested (was first) in the queue.

Constructor Detail

Queue

public Queue()
Method Detail

first

public int first()
This is needed by the pre and post debugging choice and narrow instructions to see all of the computations that were created by the choice or narrow instruction.

Returns:
int

enqueue

public void enqueue(Computation computation)
Place a computation in the queue.

Parameters:
computation - the computation to place in the queue.

next

public Computation next()
                 throws Queue.UnderflowException
Return the first computation in the queue.

Returns:
The first computation in the queue.
Throws:
Queue.UnderflowException

dequeue

public Computation dequeue()
Take out the last returned (was first) computation of the queue.


remove

public Computation remove(Computation c)

size

public int size()
Return the number of computations in the queue.

Returns:
the number of computations in the queue.

elements

public java.util.Enumeration elements()
Return an enumeration of the computations in this queue.

Returns:
An enumeration of the computations in this queue.

toString

public java.lang.String toString()
Return a printable representation of this queue.

Overrides:
toString in class java.lang.Object
Returns:
A printable representation of this queue.