org.jogre.common.comm
Class CommTableMessage

java.lang.Object
  extended byorg.jogre.common.comm.CommBaseMessage
      extended byorg.jogre.common.comm.CommGameMessage
          extended byorg.jogre.common.comm.CommTableMessage
All Implemented Interfaces:
ITransmittable
Direct Known Subclasses:
CommChatTable, CommControllerObject, CommControllerProperty, CommGameOver, CommOfferDraw, CommTableAction

public abstract class CommTableMessage
extends CommGameMessage

Abstract base class for table messages. This class is used for creating communication objects between games e.g. CommExecuteChessMove. Fields which are most commonly used include username, status and table number.

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
static int NO_TABLE
          No table being used in the message.
protected  boolean omitSender
          Boolean which specify to the server when broadcasting this message to a table to omit the original sender.
protected  int tableNum
          Table number.
static String XML_ATT_TABLE_NUM
          XML attribute for table number.
 
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
protected CommTableMessage()
          Create a communcation table object with no status.
protected CommTableMessage(boolean omitSender)
          Table communication object which when sent from server will omit the sender.
protected CommTableMessage(int status)
          Create a table message with a status.
protected CommTableMessage(int status, boolean omitSender)
          Create a communcation table object with a status which will be broadcast to a table except to the person sending it.
protected CommTableMessage(int status, String usernameTo)
          Create a table message to go to a particular user.
protected CommTableMessage(XMLElement message)
          Constructor which parses the XMLElement into class fields.
 
Method Summary
 XMLElement flatten(String name)
          Create an abstract XMLElement which sub classes can use.
 int getTableNum()
          Return the table number for this table.
 boolean isOmittingSender()
          Return true if the sender is omitted or not.
 void setTableNum(int tableNum)
          Set the table number - this is done in the API.
 
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
 
Methods inherited from interface org.jogre.common.comm.ITransmittable
flatten
 

Field Detail

NO_TABLE

public static final int NO_TABLE
No table being used in the message.

See Also:
Constant Field Values

tableNum

protected int tableNum
Table number.


omitSender

protected boolean omitSender
Boolean which specify to the server when broadcasting this message to a table to omit the original sender.


XML_ATT_TABLE_NUM

public static final String XML_ATT_TABLE_NUM
XML attribute for table number.

See Also:
Constant Field Values
Constructor Detail

CommTableMessage

protected CommTableMessage()
Create a communcation table object with no status.


CommTableMessage

protected CommTableMessage(boolean omitSender)
Table communication object which when sent from server will omit the sender.

Parameters:
omitSender - True if omitting the person who sent it.

CommTableMessage

protected CommTableMessage(int status)
Create a table message with a status.

Parameters:
status -

CommTableMessage

protected CommTableMessage(int status,
                           boolean omitSender)
Create a communcation table object with a status which will be broadcast to a table except to the person sending it.

Parameters:
status -
omitSender -

CommTableMessage

protected CommTableMessage(int status,
                           String usernameTo)
Create a table message to go to a particular user.

Parameters:
status -
usernameTo -

CommTableMessage

protected CommTableMessage(XMLElement message)
Constructor which parses the XMLElement into class fields.

Parameters:
message - Element to parse.
Method Detail

setTableNum

public void setTableNum(int tableNum)
Set the table number - this is done in the API.

Parameters:
tableNum - Set the table number.

getTableNum

public int getTableNum()
Return the table number for this table.

Returns:
Table number.

isOmittingSender

public boolean isOmittingSender()
Return true if the sender is omitted or not.

Returns:
Return true if sender is omitted.

flatten

public XMLElement flatten(String name)
Create an abstract XMLElement which sub classes can use. Note: this flatten (String name) method isn't part of the ITransmittable interface but is in here for convenience.

Overrides:
flatten in class CommGameMessage
Parameters:
name - Name of the commuication object.
Returns:
Flat XML version of this object.