From e528aec6d2d277338d7ddfdceba38d62eff08657 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Tue, 29 Sep 2015 10:03:30 -0400 Subject: More data structure work. Yet more imports from previous version. --- .../bjc/utils/data/bst/DirectedWalkFunction.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 BJC-Utils2/src/main/java/bjc/utils/data/bst/DirectedWalkFunction.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/bst/DirectedWalkFunction.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/bst/DirectedWalkFunction.java b/BJC-Utils2/src/main/java/bjc/utils/data/bst/DirectedWalkFunction.java new file mode 100644 index 0000000..232f3d4 --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/data/bst/DirectedWalkFunction.java @@ -0,0 +1,43 @@ +package bjc.utils.data.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