Class TreePrinter
- java.lang.Object
-
- org.ametys.cms.search.advanced.utils.TreePrinter
-
public final class TreePrinter extends Object
Helper toprinta tree for debug purposes.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTreePrinter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static <T> void_print(StringBuilder sb, AbstractTreeNode<T> tree, Function<T,String> leafStringifier, StringBuffer prefix, boolean isTail)static <T> Stringprint(AbstractTreeNode<T> tree)Prints the given tree
Use for debug purposes only.static <T> Stringprint(AbstractTreeNode<T> tree, Function<T,String> leafStringifier)Prints the given tree
Use for debug purposes only.
-
-
-
Constructor Detail
-
TreePrinter
private TreePrinter()
-
-
Method Detail
-
print
public static <T> String print(AbstractTreeNode<T> tree)
Prints the given tree
Use for debug purposes only.- Type Parameters:
T- the type of the values of the leaves of the tree.- Parameters:
tree- The tree to print- Returns:
- The string representing the tree
-
print
public static <T> String print(AbstractTreeNode<T> tree, Function<T,String> leafStringifier)
Prints the given tree
Use for debug purposes only.- Type Parameters:
T- the type of the values of the leaves of the tree.- Parameters:
tree- The tree to printleafStringifier- The function to transform a leaf value to a readable String- Returns:
- The string representing the tree
-
_print
private static <T> void _print(StringBuilder sb, AbstractTreeNode<T> tree, Function<T,String> leafStringifier, StringBuffer prefix, boolean isTail)
-
-