metaDesc.put("Published on", meta.getPublisher());
metaDesc.put("URL", meta.getUrl());
if (meta.isImageDocument()) {
- metaDesc.put("Number of images", format(meta.getWords()));
+ metaDesc.put("Number of images",
+ StringUtils.formatNumber(meta.getWords()));
} else {
- metaDesc.put("Number of words", format(meta.getWords()));
+ metaDesc.put("Number of words",
+ StringUtils.formatNumber(meta.getWords()));
}
metaDesc.put("Source", meta.getSource());
metaDesc.put("Subject", meta.getSubject());
}
}
- /**
- * @deprecated use StringUtils when updated
- */
- @Deprecated
- static private String format(long value) {
- //TODO: use StringUtils
-
- String display = "";
- String suffix = "";
-
- if (value > 4000) {
- value = value / 1000;
- suffix = "k";
- }
-
- while (value > 0) {
- if (!display.isEmpty()) {
- display = "." + display;
- }
- display = (value % 1000) + display;
- value = value / 1000;
- }
-
- return display + suffix;
- }
-
static private String formatDate(String date) {
long ms = 0;
}
// TODO: i18n
+ String stories = "stories";
+ String num = StringUtils.formatNumber(subtag
+ .getCount());
if (sp.isEmpty()) {
System.out.println(String.format(
- "%d/%d: %s, %d %s", page, item,
- subtag.getName(), subtag.getCount(),
- "stories"));
+ "%d/%d: %s, %s %s", page, item,
+ subtag.getName(), num, stories));
} else {
System.out.println(String.format(
- "%d/%d: %s (%s), %d %s", page, item,
- subtag.getName(), sp,
- subtag.getCount(), "stories"));
+ "%d/%d: %s (%s), %s %s", page, item,
+ subtag.getName(), sp, num, stories));
}
}
} else {