1 package org.apache.maven.jcoveragereport;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import java.util.Comparator;
21
22 /**
23 * @author Emmanuel Venisse
24 * @version $Id: PackageComparator.java 170200 2005-05-15 06:24:19Z brett $
25 */
26 public class PackageComparator implements Comparator
27 {
28 public int compare(Object package1, Object package2)
29 {
30 if (package1 instanceof Package && package2 instanceof Package)
31 {
32 Package p1 = (Package) package1;
33 Package p2 = (Package) package2;
34 if (p1.getName() != null && p2.getName() != null)
35 {
36 String lower1 = p1.getName().toLowerCase();
37 String lower2 = p2.getName().toLowerCase();
38 return lower1.compareTo(lower2);
39 }
40 else
41 {
42 if (p1.getName() == null && p2.getName() == null)
43 {
44 return 0;
45 }
46 else
47 {
48 return -1;
49 }
50 }
51 }
52 else
53 {
54 return -1;
55 }
56 }
57 }