edu.wpi.prc.task.queue
Class PriorityComparator

java.lang.Object
  extended by edu.wpi.prc.task.queue.PriorityComparator
All Implemented Interfaces:
java.util.Comparator<java.lang.Integer>

public class PriorityComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Integer>

The PriorityComparator is used to compare the priorities of two Task queues in the MultiPriorityQueue.

Author:
James Baldassari

Constructor Summary
PriorityComparator()
           
 
Method Summary
 int compare(java.lang.Integer firstPriority, java.lang.Integer secondPriority)
          Compares the priorities of two Task queues.
 
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

PriorityComparator

public PriorityComparator()
Method Detail

compare

public int compare(java.lang.Integer firstPriority,
                   java.lang.Integer secondPriority)
Compares the priorities of two Task queues.

Specified by:
compare in interface java.util.Comparator<java.lang.Integer>
Parameters:
firstPriority - The priority of the first queue.
secondPriority - The priority of the second queue.
Returns:
Returns -1, 0, or 1 if the first queue has a higher, equal, or lower priority than the second because the queues are sorted in reverse order (highest priority first) in the MultiPriorityQueue.