diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-18 08:38:24 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-18 08:38:24 -0400 |
| commit | 7c12fd8fe169944152ca73f0da4e8fe8e280f648 (patch) | |
| tree | 87a0cc6a430b0647b2daebcbec62101cfd67bbae /BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java | |
| parent | bada13a2ccedd860dfd7a45683e8e8f4ba8a038d (diff) | |
Added new option to top-down travers
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 | 20 |
1 files changed, 20 insertions, 0 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 7f28682..bbcefd3 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ITree.java @@ -155,4 +155,24 @@ public interface ITree<ContainedType> { public ITree<ContainedType> topDownTransform( Function<ContainedType, TopDownTransformResult> transformPicker, UnaryOperator<ITree<ContainedType>> transformer); + + /** + * Get the specified child of this tree + * + * @param childNo + * The number of the child to get + * @return The specified child of this tree + */ + default ITree<ContainedType> getChild(int childNo) { + return transformChild(childNo, (child) -> child); + } + + /** + * Get the data stored in this node + * + * @return The data stored in this node + */ + default ContainedType getHead() { + return transformHead((head) -> head); + } } |
