Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.contactcenters.queue
Class QueueWaitingQueue

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractQueue<DequeueEvent>
              umontreal.iro.lecuyer.contactcenters.queue.WaitingQueue
                  umontreal.iro.lecuyer.contactcenters.queue.QueueWaitingQueue

All Implemented Interfaces:
  Iterable<DequeueEvent>, Collection<DequeueEvent>, Queue<DequeueEvent>, Initializable, Named

    public class QueueWaitingQueue

extends WaitingQueue

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

### QueueWaitingQueue

    public QueueWaitingQueue()

  Constructs a waiting queue using a priority heap with `DequeueEventComparator` for dequeue event.

### QueueWaitingQueue

    public QueueWaitingQueue(Comparator<? super DequeueEvent> comparator)

  Constructs a new waiting queue using a priority heap with the comparator `comparator`.

  Parameters:
    `comparator` - the comparator used to compare events.

### QueueWaitingQueue

    public QueueWaitingQueue(Queue<DequeueEvent> queue)

  Constructs a new waiting queue using the queue `queue` as a data structure. The given waiting queue can only contain dequeue events, and is cleared before usage.

  Parameters:
    `queue` - the queue being used.
  Throws:
    `NullPointerException` - if `queue` is `null`.

Method Detail

### elementsAdd

    protected void elementsAdd(DequeueEvent dqEvent)

  Description copied from class: `WaitingQueue`
  Adds the new dequeued event `dqEvent` to the internal data structure representing the waiting queue.

  Specified by:
    `elementsAdd` in class `WaitingQueue`
  Parameters:
    `dqEvent` - the dequeue event being added.

### elementsClear

    protected void elementsClear()

  Description copied from class: `WaitingQueue`
  Clears all elements in the data structure representing the queued contacts.

  Specified by:
    `elementsClear` in class `WaitingQueue`

### elementsGetFirst

    protected DequeueEvent elementsGetFirst()

  Description copied from class: `WaitingQueue`
  Returns the first element of the waiting queue's internal data structure, or throws a `NoSuchElementException` if no such element exists.

  Specified by:
    `elementsGetFirst` in class `WaitingQueue`
  Returns:
    the first element of the data structure.

### elementsGetLast

    protected DequeueEvent elementsGetLast()

  Description copied from class: `WaitingQueue`
  Returns the last element of the waiting queue's internal data structure, or throws a `NoSuchElementException` if no such element exists.

  Specified by:
    `elementsGetLast` in class `WaitingQueue`
  Returns:
    the last element of the data structure.

### elementsIsEmpty

    protected boolean elementsIsEmpty()

  Description copied from class: `WaitingQueue`
  Determines if the internal waiting queue data structure is empty.

  Specified by:
    `elementsIsEmpty` in class `WaitingQueue`
  Returns:
    `true` if the data structure is empty, `false` otherwise.

### elementsIterator

    protected Iterator<DequeueEvent> elementsIterator()

  Description copied from class: `WaitingQueue`
  Returns an iterator capable of traversing, in the correct order, the elements in the waiting queue's internal data structure. This is different from the `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.

  Specified by:
    `elementsIterator` in class `WaitingQueue`
  Returns:
    an iterator for the waiting queue elements.

### elementsRemoveFirst

    protected DequeueEvent elementsRemoveFirst()

  Description copied from class: `WaitingQueue`
  Removes and returns the first element in the waiting queue's internal data structure. Throws a `NoSuchElementException` if no such element exists.

  Specified by:
    `elementsRemoveFirst` in class `WaitingQueue`
  Returns:
    the removed element.

### elementsRemoveLast

    protected DequeueEvent elementsRemoveLast()

  Description copied from class: `WaitingQueue`
  Removes and returns the last element in the waiting queue's internal data structure. Throws a `NoSuchElementException` if no such element exists.

  Specified by:
    `elementsRemoveLast` in class `WaitingQueue`
  Returns:
    the removed element.

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.