1: package TreePackage;
2: /**
3: An interface for a decision tree.
4:
5: @author Frank M. Carrano
6: @author Timothy M. Henry
7: @version 5.0
8: */
9: public interface DecisionTreeInterface<T> extends BinaryTreeInterface<T>
10: {
11: /** Gets the data in the current node.
12: @return The data object in the current node, or
13: null if the current node is null. */
14: public T getCurrentData();
16: /** Sets the data in the current node.
17: Precondition: The current node is not null.
18: @param newData The new data object. */
19: public void setCurrentData(T newData);
21: /** Sets the data in the children of the current node,
22: creating them if they do not exist.
23: Precondition: The current node is not null.
24: @param responseForNo The new data object for the left child.
25: @param responseForYes The new data object for the right child. */
26: public void setResponses(T responseForNo, T responseForYes);
28: /** Sees whether the current node contains an answer.
29: @return True if the current node is a leaf, or
30: false if it is a nonleaf. */
31: public boolean isAnswer();
33: /** Sets the current node to its left child.
34: If the child does not exist, sets the current node to null. */
35: public void advanceToNo();
37: /** Sets the current node to its right child.
38: If the child does not exist, sets the current node to null. */
39: public void advanceToYes();
41: /** Sets the current node to the root of the tree. */
42: public void resetCurrentNode();
43: } // end DecisionTreeInterface