1
2 package hoplugins.teamAnalyzer.comparator;
3
4 import hoplugins.teamAnalyzer.vo.PlayerAppearance;
5
6 import java.util.Comparator;
7
8
9 /***
10 * Comparator that orders based on number of appearance
11 *
12 * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
13 */
14 public class AppearanceComparator implements Comparator {
15
16
17 /***
18 * Compare two objects
19 *
20 * @param o1
21 * @param o2
22 *
23 * @return
24 */
25 public int compare(Object o1, Object o2) {
26 int s1 = ((PlayerAppearance) o1).getAppearance();
27 int s2 = ((PlayerAppearance) o2).getAppearance();
28
29 if (s1 > s2) {
30 return -1;
31 }
32
33 if (s2 > s1) {
34 return 1;
35 }
36
37 return 1;
38 }
39 }