toolbox.queueing
Class Queue

Package class diagram package Queue
java.lang.Object
  extended by toolbox.queueing.Queue

public class Queue
extends java.lang.Object

FILO Queue implementation


Constructor Summary
Queue()
          Constructs a new Queue by initializing the member LinkedList
Queue(int maxDepth)
          Constructs a new Queue with the given maximum depth
 
Method Summary
 int getSize()
          Returns the number of events contained in the queue.
 java.lang.Object pop()
          Removes an element from the queue and returns it
 void push(java.lang.Object obj)
          Places a new element in the queue or discards the event if the maximum depth has been reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Constructs a new Queue by initializing the member LinkedList


Queue

public Queue(int maxDepth)
Constructs a new Queue with the given maximum depth

Parameters:
maxDepth - Maximum depth this queue is allowed to reach.
Method Detail

push

public void push(java.lang.Object obj)
          throws QueueDiscardWarning
Places a new element in the queue or discards the event if the maximum depth has been reached.

Parameters:
obj - Object to add to queue
Throws:
QueueDiscardWarning

pop

public java.lang.Object pop()
                     throws java.lang.InterruptedException
Removes an element from the queue and returns it

Returns:
Element at the top of the queue.
Throws:
java.lang.InterruptedException

getSize

public int getSize()
Returns the number of events contained in the queue.

Returns:
Number of element queue.