Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities
Class Queue<O>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.Queue<O>

public class Queue<O>
extends Object

Provides a simple queue with a linked list data structure.

Author:
Elke Achtert

Nested Class Summary
(package private)  class Queue.QueueElement
          An element in the queue: holds the underlying objcet and the next element in the queue.
 
Field Summary
private  Queue.QueueElement first
          The first of this queue, null if the queue is empty.
private  Queue.QueueElement last
          The last element of this queue.
 
Constructor Summary
Queue()
           
 
Method Summary
 O dequeue()
          Removes the first object from the queue and returns it.
 void enqueue(O object)
          Appends the specified object to the end of the queue.
 O firstObject()
          Returns the first object of the queue, but does not remove it.
 boolean isEmpty()
          Returns true, if this queue is empty, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

first

private Queue.QueueElement first
The first of this queue, null if the queue is empty.


last

private Queue.QueueElement last
The last element of this queue.

Constructor Detail

Queue

public Queue()
Method Detail

enqueue

public void enqueue(O object)
Appends the specified object to the end of the queue.

Parameters:
object - the object to be enqueued

dequeue

public O dequeue()
Removes the first object from the queue and returns it.

Returns:
the first object of the queue
Throws:
NoSuchElementException - if the queue is empty

firstObject

public O firstObject()
Returns the first object of the queue, but does not remove it.

Returns:
the first object of the queue

isEmpty

public boolean isEmpty()
Returns true, if this queue is empty, false otherwise.

Returns:
true, if this queue is empty.

Release 0.1 (2008-07-10_1838)