Class PairIntQueue

java.lang.Object
  extended byPairIntQueue

public class PairIntQueue
extends java.lang.Object

This class implements queues of pairs of integers as linked lists from the class PairIntList. Insertions are made at the rear and deletions at the front. The link is from front to rear (i.e. the front is the head of the linked list. The queue is represented by two pointers on PairIntList objects front and rear. An empty queue is a pair (front, rear) such that front is null.


Constructor Summary
PairIntQueue()
           
 
Method Summary
 void add(int val, int elem)
          Adds the pair (val, elem) to the queue.
 void add(PairIntList l)
          Adds the head of the list l to the queue.
 void addFast(int val, int elem)
           
 boolean isEmpty()
          Returns true if the queue is empty, which means that front is null
 boolean isIn(int val, int elem)
          Returns true if the pair (val, elem) is in the queue.
static void main(java.lang.String[] args)
           
 PairIntList remove()
          Removes the first element of the queue.
 PairInt removeHead()
          Returns the first element of the queue and removes it.
 java.lang.String show(Alphabet a)
           
 java.lang.String show(java.lang.String name, Alphabet a)
           
 java.lang.String showAI(Alphabet a)
           
 java.lang.String showAI(java.lang.String name, Alphabet a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PairIntQueue

public PairIntQueue()
Method Detail

isIn

public boolean isIn(int val,
                    int elem)
Returns true if the pair (val, elem) is in the queue.


add

public void add(int val,
                int elem)
Adds the pair (val, elem) to the queue.


addFast

public void addFast(int val,
                    int elem)

add

public void add(PairIntList l)
Adds the head of the list l to the queue.


remove

public PairIntList remove()
Removes the first element of the queue.

Returns:
the resulting queue (null if the queue is empty).

removeHead

public PairInt removeHead()
Returns the first element of the queue and removes it.


isEmpty

public boolean isEmpty()
Returns true if the queue is empty, which means that front is null


showAI

public java.lang.String showAI(java.lang.String name,
                               Alphabet a)

showAI

public java.lang.String showAI(Alphabet a)

show

public java.lang.String show(java.lang.String name,
                             Alphabet a)

show

public java.lang.String show(Alphabet a)

main

public static void main(java.lang.String[] args)