X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsearchable%2FSearchableTag.java;h=c12b3c68eeeb5b0d3c2135b521bf5bbd354dbfa3;hb=596ed3d65b2585c4358935d6fbb130f50e237787;hp=af1ce0f1a50c1571a4a2841c9733ad32998445e6;hpb=76ec935e19dbd00dfbcaaeabfc187125f727b5ac;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/searchable/SearchableTag.java b/src/be/nikiroo/fanfix/searchable/SearchableTag.java index af1ce0f..c12b3c6 100644 --- a/src/be/nikiroo/fanfix/searchable/SearchableTag.java +++ b/src/be/nikiroo/fanfix/searchable/SearchableTag.java @@ -13,6 +13,8 @@ public class SearchableTag { private String name; private boolean complete; private long count; + + private SearchableTag parent; private List children; /** @@ -133,31 +135,6 @@ public class SearchableTag { return count; } - /** - * The number of items that can be found with this tag if it is searched, - * displayable format. - *

- * Will report the number of subtags by default. - * - * @return the number of items - */ - public String getCountDisplay() { - long count = this.count; - if (count <= 0) { - count = children.size(); - } - - if (count > 999999) { - return count / 1000000 + "M"; - } - - if (count > 2000) { - return count / 1000 + "k"; - } - - return Long.toString(count); - } - /** * The number of items that can be found with this tag if it is searched. * @@ -238,6 +215,16 @@ public class SearchableTag { */ public void add(SearchableTag tag) { children.add(tag); + tag.parent = this; + } + + /** + * This {@link SearchableTag} parent tag, or NULL if none. + * + * @return the parent or NULL + */ + public SearchableTag getParent() { + return parent; } /** @@ -251,7 +238,7 @@ public class SearchableTag { } if (getCount() > 0) { - rep += " (" + getCountDisplay() + ")"; + rep += " (" + getCount() + ")"; } if (!children.isEmpty()) {