From ba7711b8546e08fa6376a85271d2ca1c34cc902b Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Tue, 29 Sep 2015 16:24:37 -0400 Subject: Moved around tree stuff. --- .../utils/funcdata/bst/DirectedWalkFunction.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java new file mode 100644 index 0000000..18e80be --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java @@ -0,0 +1,43 @@ +package bjc.utils.funcdata.bst; + +/** + * Represents a function for doing a directed walk of a binary tree. + * @author ben + * + * @param + */ +@FunctionalInterface +public interface DirectedWalkFunction { + /** + * Represents the results used to direct a walk in a binary tree. + * + * @author ben + * + */ + public enum DirectedWalkResult { + /** + * Specifies that the function has succesfully completed + * + */ + SUCCESS, + /** + * Specifies that the function has failed. + */ + FAILURE, + /** + * Specifies that the function wants to move left in the tree next. + */ + LEFT, + /** + * Specifies that the function wants to move right in the tree next. + */ + RIGHT + } + + /** + * Perform a directed walk on a node of a tree. + * @param data The data stored in the node currently being visited + * @return The way the function wants the walk to go next. + */ + public DirectedWalkResult walk(T data); +} -- cgit v1.2.3