Class MessageCreator

Class MessageCreator

java.lang.Object
   |
   +----MessageCreator

class MessageCreator
extends Object
A class used in creating various specific Message objects.

It should be the only entrypoint in creating Messages !

Written: Radu Sion
Version: 0.26
Source: MessageCreator.java
See Also:
ClientMessageCreator, ServerMessageCreator, Message, MessageParser

Method Index

 o create(int, int, int, int, int)
 o DataBytes(byte[])
Creates a simple data Message initialized with a byte array.
 o DataString(String)
Creates a simple data Message initialized with the ASCII information from a String.
 o modifyDestination(Message, int, int)
Creates a new Message modifying the destination (group & number) of a provided one.
 o modifySender(Message, int, int)
Creates a new Message modifying the sender (group & number) of a provided one.
 o NOP()
Creates a NOP (empty) Message that should be ignored.
 o OK()
Creates a OK Message.

Methods

 o modifySender
  public static Message modifySender(Message mess,
                                     int player,
                                     int group)
Creates a new Message modifying the sender (group & number) of a provided one. No parameter checkings performed.
Parameters:
mess - Old Message
player - New sender number to set in the created Message
group - New sender group number to set in the created Message
Returns:
A new modified Message
 o modifyDestination
  public static Message modifyDestination(Message mess,
                                          int player,
                                          int group)
Creates a new Message modifying the destination (group & number) of a provided one.
Parameters:
mess - Old Message
player - New destination number to set in the created Message
group - New destination group number to set in the created Message
Returns:
A new modified Message
 o DataString
  public static Message DataString(String say)
Creates a simple data Message initialized with the ASCII information from a String.
Returns:
The created Message
 o DataBytes
  public static Message DataBytes(byte say[])
Creates a simple data Message initialized with a byte array.
Returns:
The created Message
 o create
  protected static Message create(int type,
                                  int sender,
                                  int sender_group,
                                  int dest,
                                  int dest_group)
 o NOP
  public static Message NOP()
Creates a NOP (empty) Message that should be ignored. (generally speaking)
 o OK
  public static Message OK()
Creates a OK Message. On receiving a OK from the server, the client should check again it's group & number with the one of the OK