|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.as.quickstarts.numberguess.Game
@Named @SessionScoped public class Game
Game contains all the business logic for the application, and also serves as the
controller for the JSF view.
It contains properties for the number to be guessed, the current guess,
the smallest and biggest numbers guessed so far (as this is a
higher/lower game we can prevent them entering numbers that they should know are wrong), and the
number of remainingGuesses.
The check() method, and reset() methods provide the business logic whilst the
validateNumberRange(FacesContext, UIComponent, Object) method provides feedback to the
user.
| Constructor Summary | |
|---|---|
Game()
|
|
| Method Summary | |
|---|---|
void |
check()
Check whether the current guess is correct, and update the biggest/smallest guesses as needed. |
int |
getBiggest()
|
int |
getGuess()
|
int |
getNumber()
|
int |
getRemainingGuesses()
|
int |
getSmallest()
|
void |
reset()
Reset the game, by putting all values back to their defaults, and getting a new random number. |
void |
setGuess(int guess)
|
void |
validateNumberRange(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent toValidate,
Object value)
A JSF validation method which checks whether the guess is valid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Game()
| Method Detail |
|---|
public int getNumber()
public int getGuess()
public void setGuess(int guess)
public int getSmallest()
public int getBiggest()
public int getRemainingGuesses()
public void check()
@PostConstruct public void reset()
public void validateNumberRange(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent toValidate,
Object value)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||