1 package jdiff; 2 3 import java.util.*; 4 5 /** 6 * Class to compare two PackageDiff objects. 7 * 8 * See the file LICENSE.txt for copyright details. 9 * @author Matthew Doar, mdoar@pobox.com 10 */ 11 class ComparePkgPdiffs implements Comparator { 12 /** 13 * Compare two package diffs by their percentage difference, 14 * and then by name. 15 */ compare(Object obj1, Object obj2)16 public int compare(Object obj1, Object obj2){ 17 PackageDiff p1 = (PackageDiff)obj1; 18 PackageDiff p2 = (PackageDiff)obj2; 19 if (p1.pdiff < p2.pdiff) 20 return 1; 21 if (p1.pdiff > p2.pdiff) 22 return -1; 23 return p1.name_.compareTo(p2.name_); 24 } 25 } 26