diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-17 20:51:38 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-17 20:51:38 -0400 |
| commit | bada13a2ccedd860dfd7a45683e8e8f4ba8a038d (patch) | |
| tree | 23d978588cb10ba28e42bd4a23834ec41c501452 /BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java | |
| parent | 77fcc58d1facffbc3af50be8c05985350e9f1355 (diff) | |
Added new tree traversal option, and some minor changes
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java | 17 |
1 files changed, 15 insertions, 2 deletions
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<ContainedType> { * The function to use to transform tokens * @return A tree with the token types transformed */ - public <MappedType> ITree<MappedType> transformTree( - Function<ContainedType, MappedType> transformer); + public <MappedType> ITree<MappedType> + transformTree(Function<ContainedType, MappedType> transformer); /** * Perform an action on each part of the tree @@ -142,4 +142,17 @@ public interface ITree<ContainedType> { public <MappedType> ITree<MappedType> rebuildTree( Function<ContainedType, MappedType> leafTransformer, Function<ContainedType, MappedType> 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<ContainedType> topDownTransform( + Function<ContainedType, TopDownTransformResult> transformPicker, + UnaryOperator<ITree<ContainedType>> transformer); } |
