package hangmanModel; class WordChar { private char _value; private ACharState _state = Hidden.Singleton; /** * Initialized to c and the hidden state. */ WordChar(char c) { _value = c; } /** * @return the string representation of this character */ final public String toString() { return _state.toString(_value, this); } /** * @param c the input character to be compared with. * @param b whether there is a match earlier in the word. * @return whether there is a match earlier in the word, or with this character. * Side effect: If this character matches, makes it Visible. */ final boolean compare(char c, boolean b) { return _state.compare(c, b, _value, this); } /** * @return whether all characters in the word are Visible. */ final boolean isVisible() { return _state.isVisible(this); } /** * Sets this WordChar to a given state. * @param state a new state. */ final void setState(ACharState state) { _state = state; } }