From 889fac2bdf993dc86f64a8893c0260fdcf848acb Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:40:33 -0400 Subject: Cleanup --- BJC-Utils2/src/main/java/bjc/utils/data/ITree.java | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/ITree.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/ITree.java b/BJC-Utils2/src/main/java/bjc/utils/data/ITree.java index 166fe3f..ff374e8 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/ITree.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/ITree.java @@ -1,18 +1,18 @@ package bjc.utils.data; -import bjc.utils.funcdata.bst.TreeLinearizationMethod; -import bjc.utils.functypes.ListFlattener; - import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.UnaryOperator; +import bjc.utils.funcdata.bst.TreeLinearizationMethod; +import bjc.utils.functypes.ListFlattener; + /** * A node in a homogeneous tree with a unlimited amount of children. * * @author ben - * + * * @param * The type of data contained in the tree nodes. * @@ -28,7 +28,7 @@ public interface ITree { /** * Prepend a child to this node. - * + * * @param child * The child to prepend to this node. */ @@ -39,21 +39,21 @@ public interface ITree { * * @param * The intermediate type being folded. - * + * * @param * The type that is the end result. - * + * * @param leafTransform * The function to use to convert leaf values. - * + * * @param nodeCollapser * The function to use to convert internal nodes and * their children. - * + * * @param resultTransformer * The function to use to convert a state to the returned * version. - * + * * @return The final transformed state. */ ReturnedType collapse(Function leafTransform, @@ -74,13 +74,13 @@ public interface ITree { * * @param mapper * The function to use to map values into trees. - * + * * @return A tree, with some nodes expanded into trees. */ - default ITree flatMapTree(Function> mapper) { + default ITree flatMapTree(final Function> mapper) { return topDownTransform(dat -> TopDownTransformResult.PUSHDOWN, node -> { if (node.getChildrenCount() > 0) { - ITree parent = node.transformHead(mapper); + final ITree parent = node.transformHead(mapper); node.doForChildren(parent::addChild); @@ -96,10 +96,10 @@ public interface ITree { * * @param childNo * The number of the child to get. - * + * * @return The specified child of this tree. */ - default ITree getChild(int childNo) { + default ITree getChild(final int childNo) { return transformChild(childNo, child -> child); } @@ -124,13 +124,13 @@ public interface ITree { * * @param * The type of the new tree. - * + * * @param leafTransformer * The function to use to transform leaf tokens. - * + * * @param operatorTransformer * The function to use to transform internal tokens. - * + * * @return The tree, with the nodes changed. */ ITree rebuildTree(Function leafTransformer, @@ -141,7 +141,7 @@ public interface ITree { * * @param nodePicker * The predicate to use to pick nodes to transform. - * + * * @param transformer * The function to use to transform picked nodes. */ @@ -152,10 +152,10 @@ public interface ITree { * * @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. */ ITree topDownTransform(Function transformPicker, @@ -166,13 +166,13 @@ public interface ITree { * * @param * The type of the transformed value. - * + * * @param childNo * The number of the child to transform. - * + * * @param transformer * The function to use to transform the value. - * + * * @return The transformed value. * * @throws IllegalArgumentException @@ -187,10 +187,10 @@ public interface ITree { * * @param * The type of the transformed value. - * + * * @param transformer * The function to use to transform the value. - * + * * @return The transformed value. */ TransformedType transformHead(Function transformer); @@ -200,13 +200,13 @@ public interface ITree { * * @param * The type of the new tree. - * + * * @param transformer * The function to use to transform tokens. - * + * * @return A tree with the token types transformed. */ - default ITree transformTree(Function transformer) { + default ITree transformTree(final Function transformer) { return rebuildTree(transformer, transformer); } @@ -215,7 +215,7 @@ public interface ITree { * * @param linearizationMethod * The way to traverse the tree. - * + * * @param action * The action to perform on each tree node. */ @@ -223,10 +223,10 @@ public interface ITree { /** * Find the farthest to right child that satisfies the given predicate. - * + * * @param childPred * The predicate to satisfy. - * + * * @return The index of the right-most child that satisfies the * predicate, or -1 if one doesn't exist. */ -- cgit v1.2.3