*) some code-cleanup

*) link-/wordcount on statuspage is now displayed with thousands separator

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3871 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
auron_x 18 years ago
parent d7de0938a6
commit 3860987c84

@ -142,8 +142,8 @@ public class Network {
prop.put("table_my-version", seed.get(yacySeed.VERSION, "-"));
prop.put("table_my-utc", seed.get(yacySeed.UTC, "-"));
prop.put("table_my-uptime", serverDate.intervalToString(60000 * Long.parseLong(seed.get(yacySeed.UPTIME, ""))));
prop.put("table_my-links", groupDigits(Long.toString(links)));
prop.put("table_my-words", groupDigits(Long.toString(words)));
prop.put("table_my-links", groupDigits(links));
prop.put("table_my-words", groupDigits(words));
prop.put("table_my-sI", groupDigits(seed.get(yacySeed.INDEX_OUT, "0")));
prop.put("table_my-sU", groupDigits(seed.get(yacySeed.URL_OUT, "0")));
prop.put("table_my-rI", groupDigits(seed.get(yacySeed.INDEX_IN, "0")));
@ -523,10 +523,7 @@ public class Network {
lValue = Long.parseLong(sValue);
} catch (Exception e) {lValue = 0;}
if (lValue == 0) { return "-"; }
sValue = Long.toString(lValue);
String rValue = "";
for (int i = 0; i < sValue.length(); i++) { rValue = sValue.charAt(sValue.length() - i - 1) + (((i % 3) == 0) ? "." : "") + rValue; }
return rValue.substring(0, rValue.length() - 1);
return groupDigits(lValue);
}
private static String groupDigits(long Number) {

@ -238,8 +238,8 @@ public class Status {
prop.put("peerStatistics_uptime", serverDate.intervalToString(uptime));
prop.put("peerStatistics_pagesperminute", yacyCore.seedDB.mySeed.get(yacySeed.ISPEED, "unknown"));
prop.put("peerStatistics_queriesperhour", Double.toString(Math.round(6000d * yacyCore.seedDB.mySeed.getQPM()) / 100d));
prop.put("peerStatistics_links", yacyCore.seedDB.mySeed.get(yacySeed.LCOUNT, "unknown"));
prop.put("peerStatistics_words", yacyCore.seedDB.mySeed.get(yacySeed.ICOUNT, "unknown"));
prop.put("peerStatistics_links", groupDigits(yacyCore.seedDB.mySeed.get(yacySeed.LCOUNT, "0")));
prop.put("peerStatistics_words", groupDigits(yacyCore.seedDB.mySeed.get(yacySeed.ICOUNT, "0")));
prop.put("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects);
prop.put("peerStatistics_seniorConnects", yacyCore.peerActions.seniorConnects);
prop.put("peerStatistics_principalConnects", yacyCore.peerActions.principalConnects);
@ -402,5 +402,25 @@ public class Status {
}
}
//TODO: groupDigits-functions (Status.java & Network.java) should
// be referenced in a single class (now double-implemented)
private static String groupDigits(String sValue) {
long lValue;
try {
if (sValue.endsWith(".0")) { sValue = sValue.substring(0, sValue.length() - 2); } // for Connects per hour, why float ?
lValue = Long.parseLong(sValue);
} catch (Exception e) {lValue = 0;}
if (lValue == 0) { return "-"; }
return groupDigits(lValue);
}
private static String groupDigits(long Number) {
final String s = Long.toString(Number);
String t = "";
for (int i = 0; i < s.length(); i++) t = s.charAt(s.length() - i - 1) + (((i % 3) == 0) ? "." : "") + t;
return t.substring(0, t.length() - 1);
}
}

Loading…
Cancel
Save