|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectClient
This class creates a client from the Scrabble lobby.
A client can be created from either the server or client lobbies, in the former case
a client connects locally.
Class provides methods called when the client receives a move (decodeLetterMove),
for receiving a dictionary from the server (receiveDictionary), and all
other protocol messages.
Server,
ServerThread| Constructor Summary | |
Client()
|
|
| Method Summary | |
void |
checkDictionary(java.lang.String dictionary)
Method that checks to see whether the client has the dictionary that the server is using. |
void |
clientLeftGame(int uid)
Passes information to the RemoteScrabble game, informing it that a client with specific uid has left the game. |
void |
clientLeftLobby(int uid)
Removes a specific client with uid from the lobby interface. |
void |
clientServerException(java.lang.Exception e)
Method to display an exception dialog to the client, informing them that the server has errored. |
void |
close()
Method to close the client's input/output streams, and finally close the client's socket. |
void |
createClient(java.lang.String hostLocation)
Creates an IRS client. |
void |
createDownloadingDialog()
Method to create a dialog showing the player that a dictionary is being downloaded from the server. |
void |
decodeLetterMove(java.lang.String letterMoves)
A method to decode a received letter move, and call the end of the turn. |
java.lang.String |
getHostLocation()
Returns the location of the host. |
Move |
getMove()
Returns a Move, stored locally as move. |
Scrabble |
getScrabble()
Returns the current Scrabble program instance. |
java.lang.String |
getServerDictionary()
Returns the dictionary the server is using as a String dictionary name. |
void |
receiveDictionary(java.lang.String firstLine)
Method that accepts the incoming dictionary set from the ServerThread. |
void |
run()
Client run, starts createClient method. |
void |
setMessageOutput(int messageType,
java.lang.String messageOutput)
Method to write to the ServerThread. |
void |
setNames(int uid,
java.lang.String name)
Sets the name locally of a specific player in the game. |
void |
start()
Client thread start. |
void |
swapLetterMove(java.lang.String swapMove)
A method to handle an incoming swap letters move. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Client()
| Method Detail |
public Scrabble getScrabble()
public java.lang.String getServerDictionary()
public java.lang.String getHostLocation()
public void createClient(java.lang.String hostLocation)
hostLocation - The location of the server.
public void setNames(int uid,
java.lang.String name)
uid - The unique identifier of the player.name - The name of the player.
public void setMessageOutput(int messageType,
java.lang.String messageOutput)
messageType - The type of message required for sending.messageOutput - The body of the message, as a String.public void clientLeftGame(int uid)
uid - The unique identifier of the player.public void clientLeftLobby(int uid)
uid - The unique identifier of the player.public void swapLetterMove(java.lang.String swapMove)
swapMove - The required letters to be swapped, formed as a String.public void decodeLetterMove(java.lang.String letterMoves)
letterMoves - The required letters to be placed, formed as a String.public Move getMove()
public void checkDictionary(java.lang.String dictionary)
dictionary - public void receiveDictionary(java.lang.String firstLine)
firstLine - The first line of the dictionary - ensures it is written.public void createDownloadingDialog()
public void clientServerException(java.lang.Exception e)
e - The exception caused.public void close()
public void start()
public void run()
run in interface java.lang.Runnable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||