diff options
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); + } } |
