import java.awt.*;

/*
 * This class represents a PriorityQueue that is ordered by ratio of
 * processTime to priority of a Job object.  The before method is
 * overridden so that it gives the proper ordering.
 */

 /* In order to use this priority queue, the following line in PQTest.java...
  *    private PQJob pq = new PQJob();         // Our PriorityQueue.
  * should be replaced by...
  *    private PQRatio pq = new PQRatio();     // Our PriorityQueue.
 */

class PQRatio extends PriorityQueue {

  // return true iff a is before b
  public boolean before (Object a, Object b) {
    Job jA = (Job) a;
    Job jB = (Job) b;

    float rA = (float) jA.processTime / (float) jA.priority;
    float rB = (float) jB.processTime / (float) jB.priority;

    return rA < rB;
  }
}
