Interface Room

All Known Implementing Classes:
GameRoom, MainRoom

public interface Room

Every type of room where a client can be needs to be able to handle incoming messages.


Field Summary
static int ADD_USER
           
static int CHAT
           
static int COLOR_CHANGE
           
static int CREATE
           
static int DRAW
           
static int END_SESSION
           
static int ERASE
           
static int ERROR
           
static int GAME_INFO
           
static int JOIN
           
static int LEAVE_GAME
           
static int LOGIN
           
static int LOGOUT
           
static int NEW_ILLUSTRATOR
           
static int REMOVE_USER
           
static int SIZE_CHANGE
           
static int START
           
static int STOP
           
static int TOPIC_REQUEST
           
 
Method Summary
 void addNewClient(Client newClient)
          Adds a new client to the room
 boolean containsUser(java.lang.String userName)
          Checks to see if a given user is in the room.
 void handleMsg(java.lang.String msg, Client sender)
          Handles a message from the client.
 Client removeClient(java.lang.String userName)
          Remove a client from the room.
 

Field Detail

ERROR

static final int ERROR
See Also:
Constant Field Values

DRAW

static final int DRAW
See Also:
Constant Field Values

ERASE

static final int ERASE
See Also:
Constant Field Values

COLOR_CHANGE

static final int COLOR_CHANGE
See Also:
Constant Field Values

SIZE_CHANGE

static final int SIZE_CHANGE
See Also:
Constant Field Values

LOGIN

static final int LOGIN
See Also:
Constant Field Values

LOGOUT

static final int LOGOUT
See Also:
Constant Field Values

CREATE

static final int CREATE
See Also:
Constant Field Values

JOIN

static final int JOIN
See Also:
Constant Field Values

START

static final int START
See Also:
Constant Field Values

STOP

static final int STOP
See Also:
Constant Field Values

LEAVE_GAME

static final int LEAVE_GAME
See Also:
Constant Field Values

END_SESSION

static final int END_SESSION
See Also:
Constant Field Values

GAME_INFO

static final int GAME_INFO
See Also:
Constant Field Values

TOPIC_REQUEST

static final int TOPIC_REQUEST
See Also:
Constant Field Values

CHAT

static final int CHAT
See Also:
Constant Field Values

ADD_USER

static final int ADD_USER
See Also:
Constant Field Values

REMOVE_USER

static final int REMOVE_USER
See Also:
Constant Field Values

NEW_ILLUSTRATOR

static final int NEW_ILLUSTRATOR
See Also:
Constant Field Values
Method Detail

handleMsg

void handleMsg(java.lang.String msg,
               Client sender)
Handles a message from the client.

Parameters:
msg - message from client
sender - the client that send the message

addNewClient

void addNewClient(Client newClient)
Adds a new client to the room

Parameters:
newClient - The client that is to be added to the room

removeClient

Client removeClient(java.lang.String userName)
Remove a client from the room. This room does not have any direct reference to a client after it has been removed

Parameters:
userName - The name of the client that is being removed
Returns:
The client that has just been removed, returns null if the given user name is not in the room

containsUser

boolean containsUser(java.lang.String userName)
Checks to see if a given user is in the room.

Parameters:
userName - the user name to search for
Returns:
true if the room contains the given user name, otherwise false