From bada13a2ccedd860dfd7a45683e8e8f4ba8a038d Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Sun, 17 Apr 2016 20:51:38 -0400 Subject: Added new tree traversal option, and some minor changes --- BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java index 624c9d6..7f28682 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java @@ -114,8 +114,8 @@ public interface ITree { * The function to use to transform tokens * @return A tree with the token types transformed */ - public ITree transformTree( - Function transformer); + public ITree + transformTree(Function transformer); /** * Perform an action on each part of the tree @@ -142,4 +142,17 @@ public interface ITree { public ITree rebuildTree( Function leafTransformer, Function operatorTransformer); + + /** + * Do a top-down transform of the tree + * + * @param transformPicker + * The function to use to pick how to progress + * @param transformer + * The function used to transform picked subtrees + * @return The tree with the transform applied to picked subtrees + */ + public ITree topDownTransform( + Function transformPicker, + UnaryOperator> transformer); } -- cgit v1.2.3