net.sf.jour.util.queue
Class Queue

java.lang.Object
  extended bynet.sf.jour.util.queue.Queue
All Implemented Interfaces:
java.io.Serializable

public class Queue
extends java.lang.Object
implements java.io.Serializable

TODO Add docs Contributing Author(s): Misha Lifschitz (Inital implementation) Vlad Skarzhevskyy (Inital implementation)

Version:
$Revision: 1.6 $ ($Author: vlads $) $Date: 2004/12/07 09:04:52 $
Author:
michaellif
See Also:
Serialized Form

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.
 java.lang.Object[] dequeueAll()
          Removes all the elements from the queue and returns the values as array.
 java.lang.Object[] dequeueAll(java.lang.Object[] a)
          Removes all the elements from the queue and returns the values as array.
 java.lang.Object enqueue(java.lang.Object element)
          Inserts a new element at the rear of the queue.
 boolean enqueueAll(Queue elements)
          Inserts a Collection of new element at the rear of the queue.
 java.lang.Object enqueueFirst(java.lang.Object element)
          Inserts a new element at the begining of the queue.
 java.lang.Object get(int i)
           
 java.lang.Object getFirst()
          Inspects the element at the top of the queue without removing it.
 java.lang.Object getLast()
          Inspects the element at the end of the queue without removing it.
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int size()
           
 java.lang.String toString()
          Log4j event Queue dumper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.

enqueueFirst

public java.lang.Object enqueueFirst(java.lang.Object element)
Inserts a new element at the begining of the queue.

Parameters:
element - element to be inserted.

enqueueAll

public boolean enqueueAll(Queue elements)
Inserts a Collection of new element at the rear of the queue.

Parameters:
elements - Collection to be inserted.

dequeue

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

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

getFirst

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

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

get

public java.lang.Object get(int i)

getLast

public java.lang.Object getLast()
Inspects the element at the end of the queue without removing it.

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

size

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

isEmpty

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

clear

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


dequeueAll

public java.lang.Object[] dequeueAll()
Removes all the elements from the queue and returns the values as array.

Returns:

dequeueAll

public java.lang.Object[] dequeueAll(java.lang.Object[] a)
Removes all the elements from the queue and returns the values as array.

Returns:

iterator

public java.util.Iterator iterator()

toString

public java.lang.String toString()
Log4j event Queue dumper

Returns:
String


Copyright © 2004 sourceforge. All Rights Reserved.