|
talx x1.0.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objecttalx.model.GameManager
This class holds all games that are currently being played, as well as reading in and writing out their corresponding states.
| Field Summary | |
static java.lang.String |
MOVE_MESSAGE_HEADER
Message Header identifying games moves. |
| Fields inherited from interface talx.util.MailConstants |
ARCHIVE_ID, BOUNCE_HEADER, COMPOSE_TIME, DEFAULT_ID, ERASE_COUNTS, EXPIRATION_TIME, NO_DELETE, NO_REPLY, REMINDER |
| Constructor Summary | |
GameManager(TransportToolkit toolkit,
Settings settings)
|
|
| Method Summary | |
void |
addService(GameService spi)
Adds the given service as provider. |
static GameState |
extractState(javax.mail.internet.MimeMessage msg)
Extracts a game state from a message, if one exists. |
void |
fireGameChangeEvent(GameState state)
Fires a GameChangeProposedEvent to the game corresponding to the given state. |
Game |
getGame(Player p)
Returns the Game associated with the given StartGame. |
static java.lang.String[] |
getPlayerData(GameState gs)
Extracts the player email and game from game state ID. |
java.lang.String |
getPlayerID(Player p)
|
GameView |
getView(Game g,
Controller controller)
This method returns the cached view associated with the game passed. |
void |
localModelChange(GameChangedEvent gse)
Invoked when a game changes state due to the local user's action. |
static javax.mail.internet.MimeMessage |
packState(GameState gs,
java.lang.String localuser)
Packages a game state into a MimeMessage. |
void |
remoteModelChange(GameChangedEvent gse)
Invoked when a game changes state due to the remote user's action. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String MOVE_MESSAGE_HEADER
| Constructor Detail |
public GameManager(TransportToolkit toolkit,
Settings settings)
throws java.io.IOException
java.lang.IllegalArgumentException - if settings contains two distinct player
objects that are .equals() to each other.
java.io.IOException| Method Detail |
public static java.lang.String[] getPlayerData(GameState gs)
public static GameState extractState(javax.mail.internet.MimeMessage msg)
throws java.io.IOException,
javax.mail.MessagingException,
java.lang.ClassNotFoundException
msg - the message that may contain a game state.
javax.mail.MessagingException - if the message could not be read as in input stream.
java.io.IOException - if the message is malformed.
This can throw any of the IOExceptions documented under ObjectInputStream.readObject().
java.lang.ClassCastException - if the attachment holds a serialized object that is not a game state.
java.lang.ClassNotFoundException - as documented under ObjectInputStream.readObject().
public static javax.mail.internet.MimeMessage packState(GameState gs,
java.lang.String localuser)
throws javax.mail.MessagingException
javax.mail.MessagingExceptionpublic void addService(GameService spi)
spi - the service that this GameManager will provide.public java.lang.String getPlayerID(Player p)
public void fireGameChangeEvent(GameState state)
state - the proposed change to the game.
public GameView getView(Game g,
Controller controller)
g - the game which will be looked up.controller - the controller that should be a listener to all views.
java.lang.NullPointerException - if g or controller is null.public Game getGame(Player p)
java.lang.NullPointerException - if p is null.public void localModelChange(GameChangedEvent gse)
localModelChange in interface GameListenergse - The event that represents the model change.public void remoteModelChange(GameChangedEvent gse)
remoteModelChange in interface GameListenergse - The event that represents the model change.
|
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.