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