From ad81c90a47a20ece6eef977e1e75f5eb73527d15 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 22 Mar 2020 22:10:40 +0000 Subject: [PATCH] Clean up Nodes.drawTree --- src/main/java/net/kemitix/node/Nodes.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/kemitix/node/Nodes.java b/src/main/java/net/kemitix/node/Nodes.java index e25dca0..4532162 100644 --- a/src/main/java/net/kemitix/node/Nodes.java +++ b/src/main/java/net/kemitix/node/Nodes.java @@ -127,20 +127,20 @@ public final class Nodes { /** * Draw a representation of the tree. * + * @param node the root node to draw * @param depth current depth for recursion + * @param the type of the node's content * @return a representation of the tree */ - @SuppressWarnings("movevariableinsideif") public static String drawTree( final Node node, final int depth ) { final StringBuilder sb = new StringBuilder(); - final String unnamed = "(unnamed)"; if (node.isNamed()) { sb.append(formatByDepth(node.getName(), depth)); } else if (!node.getChildren().isEmpty()) { - sb.append(formatByDepth(unnamed, depth)); + sb.append(formatByDepth("(unnamed)", depth)); } node.getChildren().forEach(c -> sb.append(drawTree(c, depth + 1))); return sb.toString();