org.jogre.common.comm
Class CommGameOver

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

public class CommGameOver
extends CommTableMessage

Communication object to show that a game is over.

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
static int DRAW
          Player draws with another player.
static int RESIGN
          Player losses a game.
static int WIN
          Player wins a game.
 
Fields inherited from class org.jogre.common.comm.CommTableMessage
NO_TABLE, omitSender, tableNum, XML_ATT_TABLE_NUM
 
Fields inherited from class org.jogre.common.comm.CommGameMessage
gameID, LAYER, usernameTo, XML_ATT_GAME_ID
 
Fields inherited from class org.jogre.common.comm.CommBaseMessage
layer, status, username, XML_ATT_LAYER
 
Constructor Summary
CommGameOver(int status, int scoreIncrement)
          Constructor for a game over communication object.
CommGameOver(XMLElement message)
          Constructor which reads the game over object from a String.
 
Method Summary
 XMLElement flatten()
          Flatten communciation object.
 int getScoreIncrement()
          Return the score.
 
Methods inherited from class org.jogre.common.comm.CommTableMessage
flatten, getTableNum, isOmittingSender, setTableNum
 
Methods inherited from class org.jogre.common.comm.CommGameMessage
getGameID, getUsernameTo, isUsernameToSet, setGameID
 
Methods inherited from class org.jogre.common.comm.CommBaseMessage
getStatus, getUsername, setUsername
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIN

public static final int WIN
Player wins a game.

See Also:
Constant Field Values

RESIGN

public static final int RESIGN
Player losses a game.

See Also:
Constant Field Values

DRAW

public static final int DRAW
Player draws with another player.

See Also:
Constant Field Values
Constructor Detail

CommGameOver

public CommGameOver(int status,
                    int scoreIncrement)
Constructor for a game over communication object.

Parameters:
status - Type of win e.g. WIN, DRAW or LOSS.
scoreIncrement - Increment to score if a rated game (this is negative if the player loses).

CommGameOver

public CommGameOver(XMLElement message)
             throws TransmissionException
Constructor which reads the game over object from a String.

Parameters:
message - XML element version of object.
Throws:
TransmissionException - Thrown if problem in transmission
Method Detail

getScoreIncrement

public int getScoreIncrement()
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.

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