1 package org.roller.pojos; 2 3 4 import java.io.Serializable ; 5 import java.util.Comparator ; 6 7 8 public class RefererComparator implements Comparator , Serializable 9 { 10 static final long serialVersionUID = -1658901752434218888L; 11 12 public int compare(Object val1, Object val2) 13 throws ClassCastException 14 { 15 RefererData r1 = (RefererData)val1; 16 RefererData r2 = (RefererData)val2; 17 int hits1 = r1.getDayHits().intValue(); 18 int hits2 = r2.getDayHits().intValue(); 19 20 if (hits1 > hits2) 21 { 22 return -1; 23 } 24 else if (hits1 < hits2) 25 { 26 return 1; 27 } 28 29 return r1.getRefererUrl().compareTo(r2.getRefererUrl()); 32 } 33 } 34 | Popular Tags |