ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.queue
Class DequeueEventComparator

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.queue.DequeueEventComparator
All Implemented Interfaces:
Comparator<DequeueEvent>

public class DequeueEventComparator
extends Object
implements Comparator<DequeueEvent>

Default comparator used to sort dequeue events in a priority queue. The default order for DequeueEvent is given by the Comparable.compareTo(Object) method, which sorts events according to time of occurrence, i.e., dequeue time. This is adapted for inserting dequeue events in the event list of the simulator, not in a waiting queue. This comparator can be used when the waiting queue needs a comparator to establish the order of the elements. This comparator is not needed for waiting queues using a list, i.e., StandardWaitingQueue.


Constructor Summary
DequeueEventComparator()
           
 
Method Summary
 int compare(DequeueEvent e1, DequeueEvent e2)
          Compares dequeue event e1 with the other event e2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

DequeueEventComparator

public DequeueEventComparator()
Method Detail

compare

public int compare(DequeueEvent e1,
                   DequeueEvent e2)
Compares dequeue event e1 with the other event e2. The method extracts the Contact objects from the events. The Contact.compareTo(Contact) method is then used to compare objects. A contact that cannot be extracted is assigned the null value and precedes any non-null contacts.

Specified by:
compare in interface Comparator<DequeueEvent>
Parameters:
e1 - the first event.
e2 - the second event.
Returns:
the result of the comparison.

ContactCenters
V. 0.9.9.

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