Author: toad
Date: 2007-02-14 00:38:40 +0000 (Wed, 14 Feb 2007)
New Revision: 11779

Modified:
   trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
Log:
More thorough comparator.

Modified: trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java     
2007-02-13 23:56:30 UTC (rev 11778)
+++ trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java     
2007-02-14 00:38:40 UTC (rev 11779)
@@ -48,7 +48,18 @@
                UserAlert a0 = (UserAlert) arg0;
                UserAlert a1 = (UserAlert) arg1;
                if(a0 == a1) return 0; // common case, also we should be 
consistent with == even with proxyuseralert's
-               return a0.getPriorityClass() - a1.getPriorityClass();
+               short prio0 = a0.getPriorityClass();
+               short prio1 = a1.getPriorityClass();
+               if(prio0 - prio1 == 0) {
+                       int hash0 = a0.hashCode();
+                       int hash1 = a1.hashCode();
+                       if(hash0 > hash1) return 1;
+                       if(hash1 > hash0) return -1;
+                       return 0;
+               } else {
+                       if(prio0 > prio1) return 1;
+                       else return -1;
+               }
        }

        /**


Reply via email to