diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2015-09-29 16:24:37 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2015-09-29 16:24:37 -0400 |
| commit | ba7711b8546e08fa6376a85271d2ca1c34cc902b (patch) | |
| tree | a04b8283c828eb49c978955ccef7c4cab3fe9754 /BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java | |
| parent | b964a4b44cd2c24083db8e1cccfd6de22e440861 (diff) | |
Moved around tree stuff.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/bst/DirectedWalkFunction.java | 43 |
1 files changed, 43 insertions, 0 deletions
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 <T> + */ +@FunctionalInterface +public interface DirectedWalkFunction<T> { + /** + * 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); +} |
