
package evolution;

import java.util.*;
import evolution.Evolver;

/**
 * A class that implements Comparator.
 * This prioritycomparator is used to sort the list of evolvers by there priority.
 */
public class PriorityComparator implements Comparator {

    /**
     * Comparator for the priority of two objects.
     */
    public int compare(Object e1, Object e2) {
        double priority1 =((Evolver)e1).getPriority();
        double priority2 = ((Evolver)e2).getPriority();
		if (priority1 < priority2) {
            return -1;
        }
        if (priority1 == priority2) {
            return 0;
        }
        return 1;
    }

}