|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractQueue<DequeueEvent>
umontreal.iro.lecuyer.contactcenters.queue.WaitingQueue
umontreal.iro.lecuyer.contactcenters.queue.QueueWaitingQueue
public class QueueWaitingQueue
Represents a waiting queue using a Java Queue
implementation as a
data structure. For example, PriorityQueue
can be used as a queue to
have a heap. This can be more efficient than using
PriorityWaitingQueue
, which is backed by a SortedSet
, but
WaitingQueue.getLast()
and WaitingQueue.removeLast(int)
are not supported, because
Queue
does not provide any method for getting or removing the last
element.
Moreover, the iterator does not enumerate
queued contacts in a particular order.
Field Summary |
---|
Fields inherited from class umontreal.iro.lecuyer.contactcenters.queue.WaitingQueue |
---|
dqTypeRet |
Constructor Summary | |
---|---|
QueueWaitingQueue()
Constructs a waiting queue using a priority heap with DequeueEventComparator for
dequeue event. |
|
QueueWaitingQueue(Comparator<? super DequeueEvent> comparator)
Constructs a new waiting queue using a priority heap with the comparator comparator. |
|
QueueWaitingQueue(Queue<DequeueEvent> queue)
Constructs a new waiting queue using the queue queue as a data structure. |
Method Summary | |
---|---|
protected void |
elementsAdd(DequeueEvent dqEvent)
Adds the new dequeued event dqEvent to the internal data structure representing the waiting queue. |
protected void |
elementsClear()
Clears all elements in the data structure representing the queued contacts. |
protected DequeueEvent |
elementsGetFirst()
Returns the first element of the waiting queue's internal data structure, or throws a NoSuchElementException if no such element exists. |
protected DequeueEvent |
elementsGetLast()
Returns the last element of the waiting queue's internal data structure, or throws a NoSuchElementException if no such element exists. |
protected boolean |
elementsIsEmpty()
Determines if the internal waiting queue data structure is empty. |
protected Iterator<DequeueEvent> |
elementsIterator()
Returns an iterator capable of traversing, in the correct order, the elements in the waiting queue's internal data structure. |
protected DequeueEvent |
elementsRemoveFirst()
Removes and returns the first element in the waiting queue's internal data structure. |
protected DequeueEvent |
elementsRemoveLast()
Removes and returns the last element in the waiting queue's internal data structure. |
Methods inherited from class umontreal.iro.lecuyer.contactcenters.queue.WaitingQueue |
---|
add, add, addFromOldEvent, addWaitingQueueListener, clear, clear, clearWaitingQueueListeners, getAttributes, getDefaultDequeueType, getDequeueEvent, getFirst, getId, getLast, getMaximalQueueTime, getMaximalQueueTimeGenerator, getName, getWaitingQueueListeners, init, isEmpty, iterator, iterator, notifyDequeued, notifyEnqueued, notifyInit, offer, peek, poll, remove, remove, remove, removeFirst, removeLast, removeWaitingQueueListener, restore, save, setDefaultDequeueType, setId, setMaximalQueueTimeGenerator, setName, size, size, toString |
Methods inherited from class java.util.AbstractQueue |
---|
add, addAll, element, remove |
Methods inherited from class java.util.AbstractCollection |
---|
contains, containsAll, removeAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
contains, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public QueueWaitingQueue()
DequeueEventComparator
for
dequeue event.
public QueueWaitingQueue(Comparator<? super DequeueEvent> comparator)
comparator
- the comparator used to compare events.public QueueWaitingQueue(Queue<DequeueEvent> queue)
queue
- the queue being used.
NullPointerException
- if queue is null.Method Detail |
---|
protected void elementsAdd(DequeueEvent dqEvent)
WaitingQueue
elementsAdd
in class WaitingQueue
dqEvent
- the dequeue event being added.protected void elementsClear()
WaitingQueue
elementsClear
in class WaitingQueue
protected DequeueEvent elementsGetFirst()
WaitingQueue
NoSuchElementException
if no such element exists.
elementsGetFirst
in class WaitingQueue
protected DequeueEvent elementsGetLast()
WaitingQueue
NoSuchElementException
if no such element exists.
elementsGetLast
in class WaitingQueue
protected boolean elementsIsEmpty()
WaitingQueue
elementsIsEmpty
in class WaitingQueue
protected Iterator<DequeueEvent> elementsIterator()
WaitingQueue
WaitingQueue.iterator(int)
method because this iterator returns the
contacts marked for dequeue as well as the contacts still enqueued. If the
returned iterator does not implement remove()
,
WaitingQueue.remove(Contact,int)
and WaitingQueue.getDequeueEvent(Contact)
will not work
properly.
elementsIterator
in class WaitingQueue
protected DequeueEvent elementsRemoveFirst()
WaitingQueue
NoSuchElementException
if no such element
exists.
elementsRemoveFirst
in class WaitingQueue
protected DequeueEvent elementsRemoveLast()
WaitingQueue
NoSuchElementException
if no such element
exists.
elementsRemoveLast
in class WaitingQueue
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |