org.knopflerfish.framework
public class Queue extends java.util.Vector
Queue
class represents a first-in-first-out
(FIFO) queue of objects.Constructor and Description |
---|
Queue(int size)
Constructs an Queue with the specifies maximum size.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the queue, i.e.
|
void |
insert(java.lang.Object item)
Inserts an item into the queue.
|
void |
insertFirst(java.lang.Object item)
Inserts an item first into the queue.
|
java.lang.Object |
remove()
Removes and returns the first object in the queue.
|
java.lang.Object |
removeWait(float timeout)
Removes and returns the first item in the queue.
|
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
public Queue(int size)
size
- maximum queue size.public void insert(java.lang.Object item) throws java.lang.IndexOutOfBoundsException
remove
, one of them is unblocked.item
- the item to be inserted.java.lang.IndexOutOfBoundsException
- if maximum queue size is reached.public void insertFirst(java.lang.Object item)
remove
, one of them is unblocked.item
- the item to be inserted.public java.lang.Object removeWait(float timeout)
timeout
- timeout in seconds.null
if a
timeout occurred. To distinguish timeouts, null
items should not be inserted in the queue.public java.lang.Object remove()
remove(float timeout)
but this function
blocks forever.public void close()