/* This file is part of the algoviz@vt collection of algorithm visualizations. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this distribution. If not, see . */ /** * Represents a "State." A State is simply a step in some binary search tree * operation. * * @author Andrew Whitaker (aawhitak@vt.edu) * */ public class State { private GraphicalNode node; private String feedbackText; /* The operation types available to the state */ public enum OperationType { INSERT, REMOVE, FIND }; /* The operation type of this State */ private OperationType opType; /** * Creates a new State * * @param n * The graphical node associated with this state * @param o * The operation of this state. * @param t * The string to display (usually some information about the * operation). */ public State(GraphicalNode n, OperationType o, String t) { node = n; feedbackText = t; opType = o; } /** * @return Returns the node associated with this state. */ public GraphicalNode getNode() { return node; } /** * Gets the text associated with this node. * @return the text associated with the node. */ public String getText() { return feedbackText; } /** * @return This state's operation type. */ public OperationType getOpType() { return this.opType; } }