diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:40:41 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-04-13 18:40:41 -0400 |
| commit | d4ca769e542b2489b1e23cfcbdc3a0b7275b87cd (patch) | |
| tree | 1653a7399f97fb0c63ce62e3f60fd830d5c37f70 /base/src/main/java/bjc/utils/funcutils/TreeUtils.java | |
| parent | 2ac2e31a56ae59ee582e43a90c3495f86dd9ee7a (diff) | |
Cleanup pass
Cleanup pass to uniformize things
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils/TreeUtils.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/funcutils/TreeUtils.java | 21 |
1 files changed, 10 insertions, 11 deletions
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 <T> IList<IList<T>> outlineTree(ITree<T> tre, Predicate<T> leafMarker) { @@ -29,19 +28,19 @@ public class TreeUtils { LinkedList<T> 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 <T> void findPath(ITree<T> subtree, LinkedList<T> path, Predicate<T> leafMarker, - IList<IList<T>> paths) { - if(subtree.getChildrenCount() == 0 && leafMarker.test(subtree.getHead())) { + private static <T> void findPath(ITree<T> subtree, LinkedList<T> path, + Predicate<T> leafMarker, IList<IList<T>> paths) { + if (subtree.getChildrenCount() == 0 && leafMarker.test(subtree.getHead())) { /* We're at a matching leaf node. Add it. */ IList<T> 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(); } |
