java.lang.Object
model.logic.server.dictionary.BookScrabbleHandler
- All Implemented Interfaces:
ClientHandler
-
Constructor Summary
ConstructorsConstructorDescriptionThe BookScrabbleHandler function takes in a Book object and returns an integer value. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()The close function is used to close the connection between the client and server.voidhandleClient(InputStream inFromClient, OutputStream outToClient) The handleClient function is called by the server when a client connects to it.
-
Constructor Details
-
BookScrabbleHandler
public BookScrabbleHandler()The BookScrabbleHandler function takes in a Book object and returns an integer value. The function calculates the scrabble score of the book by adding up all the individual word scores.
-
-
Method Details
-
handleClient
The handleClient function is called by the server when a client connects to it. The function takes two arguments: an InputStream and an OutputStream, which are used to communicate with the client. The function reads from the input stream until it receives a line of text that begins with either 'Q' or 'C'. If the line begins with 'Q', then this indicates that we should query our dictionary for whether a word exists in it. If so, we write "true" back to the output stream; otherwise, we write "false". Note that if there is any error reading from/- Specified by:
handleClientin interfaceClientHandler- Parameters:
inFromClient- inFromClient Read the input from the clientoutToClient- outToClient Write the response to the client
-
close
public void close()The close function is used to close the connection between the client and server. This function is called when a user logs out of their account or closes the program.- Specified by:
closein interfaceClientHandler
-