|
talx x1.0.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objecttalx.games.Game
Holds the current GameState, and provides handler and view factory methods. Implementation classes should only implement the getView and getHandler factory methods. Game instances are produced by the system from the service class's handler method as needed. Game constructors can take parameters that configure the view and handler factories. That is, the Game constructor parameters may determine which view and handler classes are returned. However, the GameHandler class itself should have a no-argument constructor, and the view should get its settings from the MailSystemDesktop, Settings objects.
| Field Summary | |
protected boolean |
isSynchronized
Indicates that the setState method should require synchronization. |
| Constructor Summary | |
Game(Player p,
GameManager gm)
|
|
| Method Summary | |
void |
addGameListener(GameListener gml)
This method adds a new listener to events fired by this Game. |
boolean |
equals(Game other)
This method compares two Games and returns true if their String representations are equal. |
void |
fireLocalModelChange()
Fires event to alert listeners that the game state has been changed by the local user. |
void |
fireLocalModelChange(GameState gs)
Convenience method for setState(gs) followed by fireLocalModelChange(). |
void |
fireRemoteModelChange()
Fires event to alert listeners that the game state has been changed by the remote user. |
void |
fireRemoteModelChange(GameState gs)
Convenience method for setState(gs) followed by fireRemoteModelChange(). |
GameManager |
getGameManager()
|
abstract GameHandler |
getHandler()
Returns the handler for this Game. |
Player |
getPlayer()
|
GameState |
getState()
Returns the current state of this Game. |
abstract GameView |
getView(MailSystemDesktop ms,
Settings settings)
Returns the view associated with this Game. |
void |
removeGameListener(GameListener gml)
This method removes a listener from the list of listeners to this Game. |
void |
setState(GameState state)
Sets the current state of this Game. |
java.lang.String |
toString()
Returns the player's ID for this game. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected boolean isSynchronized
| Constructor Detail |
public Game(Player p,
GameManager gm)
| Method Detail |
public Player getPlayer()
public abstract GameView getView(MailSystemDesktop ms,
Settings settings)
public abstract GameHandler getHandler()
public final GameState getState()
public final void setState(GameState state)
state - The desired state of this Game.
java.lang.IllegalMonitorStateException - if isSynchronized is true
and this method is being called without first acquiring a monitor lock.
This method cannot simply acquire the lock itself because the
lock should be acquired prior to issuing getState() and released
subsequent to issuing setState(), which must be handled in the
broader context.public final void addGameListener(GameListener gml)
gml - The listener that wants to hear events fired by this Game.public final void removeGameListener(GameListener gml)
gml - The listener that wants to unsubscribe from our listener list.public final void fireLocalModelChange()
public final void fireRemoteModelChange()
public void fireLocalModelChange(GameState gs)
public void fireRemoteModelChange(GameState gs)
public final GameManager getGameManager()
public boolean equals(Game other)
other - The Game that is to be compared to this.public java.lang.String toString()
|
talx x1.0.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.