org.jogre.common.comm
Class CommGameOver

java.lang.Object
  extended byorg.jogre.common.comm.CommGameMessage
      extended byorg.jogre.common.comm.CommTableMessage
          extended byorg.jogre.common.comm.CommGameOver
All Implemented Interfaces:
IGameOver, ITransmittable

public class CommGameOver
extends CommTableMessage
implements IGameOver

Communication object which describes a game over.

Version:
Alpha 0.2.3
Author:
Bob Marks

Field Summary
 
Fields inherited from class org.jogre.common.comm.CommTableMessage
NO_TABLE, tableNum, XML_ATT_TABLE_NUM
 
Fields inherited from class org.jogre.common.comm.CommGameMessage
status, username, usernameTo, XML_ATT_STATUS, XML_ATT_USERNAME, XML_ATT_USERNAME_TO
 
Fields inherited from interface org.jogre.common.IGameOver
AGREED_DRAW, DRAW, LOSE, RESULTS, USER_RESIGNS, WIN
 
Constructor Summary
CommGameOver(int resultType)
          Message which is sent a client to the server to inform that a game is over.
CommGameOver(int tableNum, GameOver gameOver)
          Constructor which takes a table number and a game over message.
CommGameOver(XMLElement message)
          Constructor which reads the game over object from an XML element.
 
Method Summary
 XMLElement flatten()
          Flatten communciation object.
 GameOver getGameOver()
          Return the score.
 
Methods inherited from class org.jogre.common.comm.CommTableMessage
flatten, getTableNum, setTableNum
 
Methods inherited from class org.jogre.common.comm.CommGameMessage
getStatus, getUsername, getUsernameTo, isUsernameSet, isUsernameToSet, setUsername, setUsernameTo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommGameOver

public CommGameOver(int tableNum,
                    GameOver gameOver)
Constructor which takes a table number and a game over message. This is sent from the server to a client.

Parameters:
tableNum - Table number.
gameOver - Game over message.

CommGameOver

public CommGameOver(int resultType)
Message which is sent a client to the server to inform that a game is over. The server generally does its own check to ensure that this is correct.

Parameters:
resultType - Result type (see IGameOver).

CommGameOver

public CommGameOver(XMLElement message)
Constructor which reads the game over object from an XML element.

Parameters:
message - XML element version of object.
Method Detail

getGameOver

public GameOver getGameOver()
Return the score. If its a draw this will probobly be 0, a win a positive number and a negative number depending on the game.

Returns:
score increment.

flatten

public XMLElement flatten()
Flatten communciation object.

Specified by:
flatten in interface ITransmittable
Returns:
XML version of the state of an object which can be constructed again.
See Also:
ITransmittable.flatten()