org.simoes.lpd.util
Class Queue

java.lang.Object
  extended byorg.simoes.lpd.util.Queue

public class Queue
extends java.lang.Object

Queue is just a queue

Author:
Jason Crowe

Field Summary
protected static long counter
           
static long INVALID_ID
           
protected  java.lang.String name
           
protected  java.util.List queue
           
 
Constructor Summary
Queue(java.lang.String name)
          constructor.
 
Method Summary
 long add(java.lang.Object object)
          add method.
 java.lang.String getName()
          getName.
 QueuedObject getNext()
          Gets the last Object in the Queue without removing it.
 java.util.List list()
          list of the items in the queue (a copy of each one).
static void main(java.lang.String[] args)
           
 java.lang.Object remove(long id)
          remove by unique identifier.
 int size()
          size of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_ID

public static final long INVALID_ID
See Also:
Constant Field Values

counter

protected static long counter

name

protected java.lang.String name

queue

protected java.util.List queue
Constructor Detail

Queue

public Queue(java.lang.String name)
constructor.

Parameters:
name - - name of the print queue.
Method Detail

getName

public java.lang.String getName()
getName.

Returns:
the queue name.

add

public long add(java.lang.Object object)
add method.

Parameters:
object - - object to add to the queue.
Returns:
unique identifier of the queued object.

remove

public java.lang.Object remove(long id)
                        throws ObjectNotFoundException
remove by unique identifier.

Parameters:
id - - unique identifier of the queued object.
Returns:
object matching the identifier
Throws:
ObjectNotFoundException - if the object is not found in the queue

size

public int size()
size of the queue.

Returns:
size of the queue.

list

public java.util.List list()
list of the items in the queue (a copy of each one).

Returns:
a copy of the items in the list

getNext

public QueuedObject getNext()
                     throws ObjectNotFoundException
Gets the last Object in the Queue without removing it.

Returns:
QueuedObject the last QueuedObject in the queue
Throws:
ObjectNotFoundException

main

public static void main(java.lang.String[] args)