org.jogre.common.comm
Class CommChatGame

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

public class CommChatGame
extends CommGameMessage

Communication class which is used to broadcast a chat message to all users at a particular game.

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
static int BROADCAST
          Broadcast to all users in a game.
protected  String chat
          Chat String.
static int PRIVATE
          Send to a single user in a private conversation.
 
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
CommChatGame(String chat)
          Constructer for a broadcast message which is sent to everyone.
CommChatGame(String chat, String usernameTo)
          Constructer for a private message which takes a message and a usernameTo.
CommChatGame(XMLElement message)
          Constructor which creates a CommChatBroadcast object from the flatten () method of another CommChatBroadcast object.
 
Method Summary
 XMLElement flatten()
          Transmittable String representation of this object.
 String getChat()
          Return the content of the message.
 
Methods inherited from class org.jogre.common.comm.CommGameMessage
flatten, 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

BROADCAST

public static final int BROADCAST
Broadcast to all users in a game.

See Also:
Constant Field Values

PRIVATE

public static final int PRIVATE
Send to a single user in a private conversation.

See Also:
Constant Field Values

chat

protected String chat
Chat String.

Constructor Detail

CommChatGame

public CommChatGame(String chat)
Constructer for a broadcast message which is sent to everyone.

Parameters:
chat - Chat message from user.

CommChatGame

public CommChatGame(String chat,
                    String usernameTo)
Constructer for a private message which takes a message and a usernameTo.

Parameters:
chat - Chat message from user.
usernameTo - Name of user the chat is going to.

CommChatGame

public CommChatGame(XMLElement message)
             throws TransmissionException
Constructor which creates a CommChatBroadcast object from the flatten () method of another CommChatBroadcast object.

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

flatten

public XMLElement flatten()
Transmittable String representation of this object.

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

getChat

public String getChat()
Return the content of the message.

Returns:
Chat message.