de.zeigermann.xpa.tokenParser
Class LinkedListTokenQueue

java.lang.Object
  |
  +--de.zeigermann.xpa.tokenParser.LinkedListTokenQueue

public class LinkedListTokenQueue
extends Object

This class is a very simple implementation of a token queue using a linked list. When tokens are queued they are added at the end of the list. Accordingly, the first element of the list will be returned and removed when you take an element out of the queue, as a queue is FIFO.


Field Summary
protected  LinkedList tokens
           
 
Constructor Summary
LinkedListTokenQueue()
           
 
Method Summary
 Token dequeue()
          Removes a token from this queue and returns it.
 void queue(Token token)
          Adds a token to this queue.
 int size()
          Gets the current size of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

protected LinkedList tokens
Constructor Detail

LinkedListTokenQueue

public LinkedListTokenQueue()
Method Detail

queue

public void queue(Token token)
Adds a token to this queue.


dequeue

public Token dequeue()
Removes a token from this queue and returns it.

Throws:
NoSuchElementException - if queue is empty

size

public int size()
Gets the current size of the queue. This means how many tokens are queued.



Copyright 1999-2003 Oliver Zeigermann. All Rights Reserved.