drcl.util.queue
Class FIFOQueue
java.lang.Object
|
+--drcl.DrclObj
|
+--drcl.util.queue.Queue
|
+--drcl.util.queue.SimpleQueue
|
+--drcl.util.queue.FIFOQueue
- All Implemented Interfaces:
- java.lang.Cloneable, ObjectDuplicable, java.io.Serializable
- public class FIFOQueue
- extends SimpleQueue
A first-in-first-out queue.
- See Also:
- Serialized Form
|
Method Summary |
boolean |
containsKey(double key_)
Returns true if the queue contains the key. |
boolean |
enqueue(double key_,
java.lang.Object element_,
int size_)
Enqueues the element with the associated key. |
boolean |
enqueueAt(int pos_,
double key_,
java.lang.Object element_,
int size_)
Enqueues the element at the position specified with the associated key. |
boolean |
merge(Queue that_)
Enqueues the elements in the queue that_ by the order of
that_.dequeue(). |
java.lang.Object[] |
retrieveAll(double key_)
Returns all the elements with the keys matched to the argument. |
java.lang.Object |
retrieveBy(double key_)
Returns the first element with the key matched to the argument. |
| Methods inherited from class drcl.util.queue.SimpleQueue |
_retrieveAll, contains, dequeue, dequeue, enqueue, enqueue, enqueue, enqueueAfter, enqueueAfter, enqueueAt, firstElement, firstKey, getElementEnumerator, getKeyEnumerator, getLength, getMaxSize, getSize, isEmpty, isFull, isFull, keys, lastElement, lastKey, oneline, remove, remove, remove, removeAll, removeAll, reset, retrieveAll, retrieveAt, retrieveKey, retrieveKeyAt, setMaxSize |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FIFOQueue
public FIFOQueue()
FIFOQueue
public FIFOQueue(int size_)
enqueue
public boolean enqueue(double key_,
java.lang.Object element_,
int size_)
- Description copied from class:
Queue
- Enqueues the element with the associated key. The elements in queue are sorted
in the ascending order of their associated keys. If same keys appear in the queue,
the element is put right after the last element with the same key.
- Overrides:
enqueue in class SimpleQueue
- Following copied from class:
drcl.util.queue.Queue
- Parameters:
key_ - the associated key.element_ - the element to be put in the queue.size_ - size of the element.- Returns:
- false if the queue is full.
enqueueAt
public boolean enqueueAt(int pos_,
double key_,
java.lang.Object element_,
int size_)
- Description copied from class:
Queue
- Enqueues the element at the position specified with the associated key.
Note that the elements in queue are sorted in the ascending order of their associated keys.
Enqueue fails if position and key conflict with each other by the above condition.
- Overrides:
enqueueAt in class SimpleQueue
- Following copied from class:
drcl.util.queue.Queue
- Parameters:
pos_ - the position.key_ - the associated key.element_ - the element to be put in the queue.size_ - size of the element.- Returns:
- false if the queue is full or key and position conflict with each other.
merge
public boolean merge(Queue that_)
- Description copied from class:
Queue
- Enqueues the elements in the queue
that_ by the order of
that_.dequeue().
- Overrides:
merge in class SimpleQueue
- Following copied from class:
drcl.util.queue.Queue
- Returns:
- false if not all the elements in
that_ are successfully enqueued.
retrieveBy
public java.lang.Object retrieveBy(double key_)
- Description copied from class:
Queue
- Returns the first element with the key matched to the argument. No dequeue is performed.
Returns null if no match is found.
- Overrides:
retrieveBy in class SimpleQueue
retrieveAll
public java.lang.Object[] retrieveAll(double key_)
- Description copied from class:
Queue
- Returns all the elements with the keys matched to the argument.
No dequeue is performed.
- Overrides:
retrieveAll in class SimpleQueue
containsKey
public boolean containsKey(double key_)
- Description copied from class:
Queue
- Returns true if the queue contains the key.
- Overrides:
containsKey in class SimpleQueue
Copyright © 2001 - DRCL, OSU ~ Back to JavaSim Home ~