1 18 package org.apache.roller.pojos; 19 20 21 import java.io.Serializable ; 22 import java.util.Comparator ; 23 24 25 public class RefererComparator implements Comparator , Serializable 26 { 27 static final long serialVersionUID = -1658901752434218888L; 28 29 public int compare(Object val1, Object val2) 30 throws ClassCastException 31 { 32 RefererData r1 = (RefererData)val1; 33 RefererData r2 = (RefererData)val2; 34 int hits1 = r1.getDayHits().intValue(); 35 int hits2 = r2.getDayHits().intValue(); 36 37 if (hits1 > hits2) 38 { 39 return -1; 40 } 41 else if (hits1 < hits2) 42 { 43 return 1; 44 } 45 46 return r1.getRefererUrl().compareTo(r2.getRefererUrl()); 49 } 50 } 51 | Popular Tags |