jsint
Class Queue

java.lang.Object
  extended byjsint.Queue

public class Queue
extends java.lang.Object

A queue, q, is a Pair (cons ,last ,content), see Peter's, PAIP book.

This lets .add() be written without a null comparison, but uses an extra Pair.

Used by InputPort.readTail and U.append.


Constructor Summary
Queue()
          Create an empty Queue.
Queue(java.lang.Object item)
          Create a Queue containing the single element, item.
 
Method Summary
 Queue add(java.lang.Object item)
          Add an item to the end of the Queue.
 java.lang.Object front()
          Return the first item in the Queue, or null if the Queue is empty.
 java.lang.Object getContent()
          Get the Queue's content as a Pair list.
 Pair getLast()
          Get the last Pair of the Queue's content.
 java.lang.Object pop()
           
 Queue remove()
          Remove an item from the front of the Queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Create an empty Queue.


Queue

public Queue(java.lang.Object item)
Create a Queue containing the single element, item.

Method Detail

getLast

public Pair getLast()
Get the last Pair of the Queue's content.


getContent

public java.lang.Object getContent()
Get the Queue's content as a Pair list.


add

public Queue add(java.lang.Object item)
Add an item to the end of the Queue.


remove

public Queue remove()
Remove an item from the front of the Queue.


front

public java.lang.Object front()
Return the first item in the Queue, or null if the Queue is empty.


pop

public java.lang.Object pop()