1 18 package net.sf.drftpd.util; 19 20 import java.util.Comparator ; 21 22 import net.sf.drftpd.master.command.plugins.TransferStatistics; 23 import net.sf.drftpd.master.usermanager.User; 24 25 30 public class UserComparator implements Comparator { 31 32 private String _type; 33 34 public UserComparator(String type) { 35 _type = type; 36 } 37 38 public int compare(Object o1, Object o2) { 39 User u1 = (User) o1; 40 User u2 = (User) o2; 41 42 long thisVal = 43 TransferStatistics.getStats( 44 _type, 45 u1); 46 long anotherVal = 47 TransferStatistics.getStats( 48 _type, 49 u2); 50 return (thisVal > anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1)); 51 } 52 53 } 54 | Popular Tags |