[freenet-cvs] r11243 - trunk/freenet/src/freenet/clients/http
cvs at freenetproject.org
cvs at freenetproject.org
Tue Dec 5 19:03:22 UTC 2006
Author: nextgens
Date: 2006-12-05 19:03:20 +0000 (Tue, 05 Dec 2006)
New Revision: 11243
Modified:
trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
Log:
Still improving the Array comparator
Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java 2006-12-05 18:43:12 UTC (rev 11242)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java 2006-12-05 19:03:20 UTC (rev 11243)
@@ -84,16 +84,15 @@
}else if(sortBy.equals("address")){
result = firstNode.getPeerAddress().compareToIgnoreCase(secondNode.getPeerAddress());
}else if(sortBy.equals("location")){
- double diff = firstNode.getLocation() - secondNode.getLocation();
- result = diff < 0 ? -1 : 1; // It shouldn't ever be equal anyway
+ result = (int) firstNode.getLocation() - (int) secondNode.getLocation();
}else if(sortBy.equals("version")){
- int diff = Version.getArbitraryBuildNumber(firstNode.getVersion()) - Version.getArbitraryBuildNumber(secondNode.getVersion());
- result = (diff == 0 ? 0 : (diff < 0 ? -1 : 1));
+ result = Version.getArbitraryBuildNumber(firstNode.getVersion()) - Version.getArbitraryBuildNumber(secondNode.getVersion());
}else if(sortBy.equals("privnote")){
- result = firstNode.getPrivateDarknetCommentNote().compareTo(secondNode.getPrivateDarknetCommentNote());
+ result = firstNode.getPrivateDarknetCommentNote().compareToIgnoreCase(secondNode.getPrivateDarknetCommentNote());
}else
isSet=false;
- }
+ }else
+ isSet=false;
if(!isSet){
int statusDifference = firstNode.getStatusValue() - secondNode.getStatusValue();
@@ -103,12 +102,14 @@
result = firstNode.getName().compareToIgnoreCase(secondNode.getName());
}
- if(request.isParameterSet("reversed")){
+ if(result == 0){
+ return 0;
+ }else if(request.isParameterSet("reversed")){
isReversed = true;
- return (result == 0 ? 0 : (result == 1 ? -1 : 1));
+ return result > 0 ? -1 : 1;
}else{
isReversed = false;
- return result;
+ return result < 0 ? -1 : 1;
}
}
});
More information about the cvs
mailing list