|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMainRoom
public class MainRoom
Main Room for Users This is the main control for the server. It holds a collection of clients in the main room and available games to connect to.
Field Summary |
---|
Fields inherited from interface Room |
---|
ADD_USER, CHAT, COLOR_CHANGE, CREATE, DRAW, END_SESSION, ERASE, ERROR, GAME_INFO, JOIN, LEAVE_GAME, LOGIN, LOGOUT, NEW_ILLUSTRATOR, REMOVE_USER, SIZE_CHANGE, START, STOP, TOPIC_REQUEST |
Constructor Summary | |
---|---|
MainRoom()
Construct and initialize the server |
Method Summary | |
---|---|
void |
addNewClient(Client newClient)
Adds a new client to the set of current clients Starts a new thread that waits for another client |
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 messages from client |
static void |
main(java.lang.String[] args)
|
Client |
removeClient(java.lang.String userName)
Remove a client from the room. |
void |
removeGame(GameRoom game)
Removes the given game from the game list |
boolean |
sendTo(java.lang.String userName,
java.lang.String msg)
Sends a given message to a given client |
void |
sendToAllClients(java.lang.String message)
Sends a message to all clients |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MainRoom()
Method Detail |
---|
public void addNewClient(Client newClient)
addNewClient
in interface Room
newClient
- The new client that is joining the serverpublic boolean sendTo(java.lang.String userName, java.lang.String msg)
userName
- The name of the user to send the message tomsg
- The message that is being sentpublic void sendToAllClients(java.lang.String message)
message
- The message that is sent to every clientpublic Client removeClient(java.lang.String userName)
removeClient
in interface Room
userName
- The name of the client that is being removed
public void handleMsg(java.lang.String msg, Client sender)
handleMsg
in interface Room
msg
- the message or command that is being sentsender
- the client who sent the messagepublic boolean containsUser(java.lang.String userName)
containsUser
in interface Room
userName
- the user name to search for
public void removeGame(GameRoom game)
game
- the game that is being removedpublic static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |