From d4ca769e542b2489b1e23cfcbdc3a0b7275b87cd Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:40:41 -0400 Subject: Cleanup pass Cleanup pass to uniformize things --- .../main/java/bjc/utils/funcutils/TreeUtils.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'base/src/main/java/bjc/utils/funcutils/TreeUtils.java') diff --git a/base/src/main/java/bjc/utils/funcutils/TreeUtils.java b/base/src/main/java/bjc/utils/funcutils/TreeUtils.java index bbb9153..d525773 100644 --- a/base/src/main/java/bjc/utils/funcutils/TreeUtils.java +++ b/base/src/main/java/bjc/utils/funcutils/TreeUtils.java @@ -14,13 +14,12 @@ import bjc.funcdata.IList; */ public class TreeUtils { /** - * Convert a tree into a list of outline nodes that match a certain - * path. - * + * Convert a tree into a list of outline nodes that match a certain path. + * * @param tre - * The tree to outline. + * The tree to outline. * @param leafMarker - * The path to mark nodes with. + * The path to mark nodes with. * @return The list of marked paths. */ public static IList> outlineTree(ITree tre, Predicate leafMarker) { @@ -29,19 +28,19 @@ public class TreeUtils { LinkedList path = new LinkedList<>(); path.add(tre.getHead()); - tre.doForChildren((child) -> findPath(child, path, leafMarker, paths)); + tre.doForChildren(child -> findPath(child, path, leafMarker, paths)); return paths; } /* Find a path in a tree. */ - private static void findPath(ITree subtree, LinkedList path, Predicate leafMarker, - IList> paths) { - if(subtree.getChildrenCount() == 0 && leafMarker.test(subtree.getHead())) { + private static void findPath(ITree subtree, LinkedList path, + Predicate leafMarker, IList> paths) { + if (subtree.getChildrenCount() == 0 && leafMarker.test(subtree.getHead())) { /* We're at a matching leaf node. Add it. */ IList finalPath = new FunctionalList<>(); - for(T ePath : path) { + for (T ePath : path) { finalPath.add(ePath); } @@ -52,7 +51,7 @@ public class TreeUtils { /* Check the children of this node. */ path.add(subtree.getHead()); - subtree.doForChildren((child) -> findPath(child, path, leafMarker, paths)); + subtree.doForChildren(child -> findPath(child, path, leafMarker, paths)); path.removeLast(); } -- cgit v1.2.3