@Override public void print(final Taxonomy<T> taxonomy, final PrintWriter out) { _taxonomyImpl = taxonomy; _out = out; out.println(); printTree(); out.println(); out.flush(); }
@Override public void print(final Taxonomy<T> taxonomy, final PrintWriter out) { _taxonomyImpl = taxonomy; _out = out; out.println(); printTree(); out.println(); out.flush(); }
/** * Print the tree rooted at the given _node * * @param _node * @param indent */ protected void printTree(final Set<T> set, final String indent) { if (set.contains(_taxonomyImpl.getBottomNode().getName())) return; printNode(set, indent); final T c = set.iterator().next(); final Set<Set<T>> subs = ss(_taxonomyImpl.getSubs(c, true)); final Iterator<Set<T>> j = subs.iterator(); while (j.hasNext()) { final Set<T> eqs = j.next(); if (eqs.contains(c)) continue; printTree(s(eqs), indent + " "); } }
/** * Print the taxonomy as an indented tree */ protected void printTree() { final Set<T> top = new TreeSet<>(Comparators.stringComparator); top.add(_taxonomyImpl.getTop().getName()); top.addAll(_taxonomyImpl.getTop().getEquivalents()); printTree(top, " "); final Set<T> bottom = new TreeSet<>(Comparators.stringComparator); bottom.add(_taxonomyImpl.getBottomNode().getName()); bottom.addAll(_taxonomyImpl.getBottomNode().getEquivalents()); if (bottom.size() > 1) printNode(bottom, " "); }
/** * Print the tree rooted at the given _node * * @param _node * @param indent */ protected void printTree(final Set<T> set, final String indent) { if (set.contains(_taxonomyImpl.getBottomNode().getName())) return; printNode(set, indent); final T c = set.iterator().next(); final Set<Set<T>> subs = ss(_taxonomyImpl.getSubs(c, true)); final Iterator<Set<T>> j = subs.iterator(); while (j.hasNext()) { final Set<T> eqs = j.next(); if (eqs.contains(c)) continue; printTree(s(eqs), indent + " "); } }
/** * Print the taxonomy as an indented tree */ protected void printTree() { final Set<T> top = new TreeSet<>(Comparators.stringComparator); top.add(_taxonomyImpl.getTop().getName()); top.addAll(_taxonomyImpl.getTop().getEquivalents()); printTree(top, " "); final Set<T> bottom = new TreeSet<>(Comparators.stringComparator); bottom.add(_taxonomyImpl.getBottomNode().getName()); bottom.addAll(_taxonomyImpl.getBottomNode().getEquivalents()); if (bottom.size() > 1) printNode(bottom, " "); }