edu.umk.mat.merdacz.utils
Class Queue

java.lang.Object
  extended byedu.umk.mat.merdacz.utils.Queue

public class Queue
extends java.lang.Object

Author:
Marcin Daczkowski

Field Summary
private  java.util.LinkedList items
           
 
Constructor Summary
Queue()
          Creats an empty queue
 
Method Summary
 void clear()
          Removes all elements at the queue.
 java.lang.Object dequeue()
          Removes the element at the top of the queue.
 boolean empty()
           
 java.lang.Object enqueue(java.lang.Object element)
          Inserts a new element at the rear of the queue.
 java.lang.Object front()
          Inspects the element at the top of the queue without removing it.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

private java.util.LinkedList items
Constructor Detail

Queue

public Queue()
Creats an empty queue

Method Detail

enqueue

public java.lang.Object enqueue(java.lang.Object element)
Inserts a new element at the rear of the queue.

Parameters:
element - element to be inserted.

dequeue

public java.lang.Object dequeue()
                         throws EmptyQueueException
Removes the element at the top of the queue.

Returns:
the removed element.
Throws:
EmptyQueueException
EmptyQueueException - if the queue is empty.

front

public java.lang.Object front()
                       throws EmptyQueueException
Inspects the element at the top of the queue without removing it.

Returns:
the element at the top of the queue.
Throws:
EmptyQueueException
EmptyQueueException - if the queue is empty.

size

public int size()
Returns:
the number of elements at the queue.

empty

public boolean empty()
Returns:
true of the queue is empty.

clear

public void clear()
Removes all elements at the queue.