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