|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PairIntQueue
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 |
public PairIntQueue()
Method Detail |
public boolean isIn(int val, int elem)
(val, elem)
is in the queue.
public void add(int val, int elem)
(val, elem)
to the queue.
public void addFast(int val, int elem)
public void add(PairIntList l)
l
to the queue.
public PairIntList remove()
null
if the queue
is empty).public PairInt removeHead()
public boolean isEmpty()
true
if the queue is empty, which means
that front
is null
public java.lang.String showAI(java.lang.String name, Alphabet a)
public java.lang.String showAI(Alphabet a)
public java.lang.String show(java.lang.String name, Alphabet a)
public java.lang.String show(Alphabet a)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |