Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

hangman1
Class Visit  view Visit download Visit.java

java.lang.Object
  extended byhangman1.Visit

public class Visit
extends java.lang.Object

The Visit class runs most of the game logic and acts as controller, mediating between the pure interface code and the pure logic code.


Nested Class Summary
static class Visit.GuessBean
          Added for the JSF version.
 
Field Summary
private  Game _game
           
private  WordSource _wordSource
           
 
Constructor Summary
Visit()
           
 
Method Summary
 Game getGame()
          Returns the Game instance for this Visit; this is used primarily by the Guess page to display things like the number of remaining guesses and the list of guessed and unguessed letters.
 Visit.GuessBean[] getGuesses()
          Added for JSF version.
 java.lang.String[] getLetters()
          Added as a bridge to Game.getLetters(), turning the char[] into a String[], because the JSF UIData component doesn't handle primitive type arrays (and String is easier to compare with in an EL expression).
 java.lang.String makeGuess(char ch)
          Processes the player's guess, possibly updating the response page to be "Win" or "Lose".
 java.lang.String startGame()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_wordSource

private WordSource _wordSource

_game

private Game _game
Constructor Detail

Visit

public Visit()
Method Detail

startGame

public java.lang.String startGame()

makeGuess

public java.lang.String makeGuess(char ch)
Processes the player's guess, possibly updating the response page to be "Win" or "Lose".


getGame

public Game getGame()
Returns the Game instance for this Visit; this is used primarily by the Guess page to display things like the number of remaining guesses and the list of guessed and unguessed letters.


getLetters

public java.lang.String[] getLetters()
Added as a bridge to Game.getLetters(), turning the char[] into a String[], because the JSF UIData component doesn't handle primitive type arrays (and String is easier to compare with in an EL expression). This is a JSF flaw that will hopefully be fixed in a future version.


getGuesses

public Visit.GuessBean[] getGuesses()
Added for JSF version. Returns an array of GuessBean instances with one element per guess.