org.jogre.common.comm
Class CommGameMessage

java.lang.Object
  extended byorg.jogre.common.comm.CommBaseMessage
      extended byorg.jogre.common.comm.CommGameMessage
All Implemented Interfaces:
ITransmittable
Direct Known Subclasses:
CommChatGame, CommDisconnect, CommGameConnect, CommInvite, CommTableMessage

public abstract class CommGameMessage
extends CommBaseMessage

This is a message class which goes to a particular game such as chess, checkers etc. The extending class doesn't have to set the game - this is done behind the scenes. The gameID should be the game and version seperated with a colon e.g. chess:0.1

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
protected  String gameID
          Each JOGRE game should have an ID
static int LAYER
          Declare this class as a game type of message.
protected  String usernameTo
          Username of the person who this is being sent to (if empty then no one).
static String XML_ATT_GAME_ID
          Game ID.
 
Fields inherited from class org.jogre.common.comm.CommBaseMessage
layer, status, username, XML_ATT_LAYER
 
Constructor Summary
CommGameMessage()
          Empty Constructor.
CommGameMessage(int status)
          Call constructor.
CommGameMessage(int status, String usernameTo)
          Constructor which takes a status and a username to.
CommGameMessage(String usernameTo)
          Constructor which only takes a usernameTo.
CommGameMessage(XMLElement message)
          Constructor which takes an XMLElement from a flatten method of another CommGameMessage object.
 
Method Summary
 XMLElement flatten(String name)
          Create a generic (nameless) XMLElement which sub classes can use.
 String getGameID()
          Return the game ID.
 String getUsernameTo()
          Set the optional usernameTo variable.
 boolean isUsernameToSet()
          Return true / false on the usernameTo being set.
 void setGameID(String gameID)
          Set the game ID.
 
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
 
Methods inherited from interface org.jogre.common.comm.ITransmittable
flatten
 

Field Detail

LAYER

public static final int LAYER
Declare this class as a game type of message.

See Also:
Constant Field Values

XML_ATT_GAME_ID

public static final String XML_ATT_GAME_ID
Game ID.

See Also:
Constant Field Values

gameID

protected String gameID
Each JOGRE game should have an ID


usernameTo

protected String usernameTo
Username of the person who this is being sent to (if empty then no one).

Constructor Detail

CommGameMessage

public CommGameMessage()
Empty Constructor.


CommGameMessage

public CommGameMessage(int status)
Call constructor. Note that the username and game is created from the JOGRE API.

Parameters:
status -

CommGameMessage

public CommGameMessage(int status,
                       String usernameTo)
Constructor which takes a status and a username to.

Parameters:
status -
usernameTo -

CommGameMessage

public CommGameMessage(String usernameTo)
Constructor which only takes a usernameTo.

Parameters:
usernameTo -

CommGameMessage

public CommGameMessage(XMLElement message)
Constructor which takes an XMLElement from a flatten method of another CommGameMessage object.

Parameters:
message -
Method Detail

setGameID

public void setGameID(String gameID)
Set the game ID. The gameID should be of this format : e.g. "chess-0.1".

Parameters:
gameID -

getGameID

public String getGameID()
Return the game ID.

Returns:
Game id

getUsernameTo

public String getUsernameTo()
Set the optional usernameTo variable.

Returns:
username

isUsernameToSet

public boolean isUsernameToSet()
Return true / false on the usernameTo being set.

Returns:
True if usernameTo is set.

flatten

public XMLElement flatten(String name)
Create a generic (nameless) XMLElement which sub classes can use.

Overrides:
flatten in class CommBaseMessage
Parameters:
name - Name of the XML element.
Returns:
XML version of this class.