Package org.cis1200
Class ResponseSet
java.lang.Object
org.cis1200.ResponseSet
A
ResponseSet
stores a set of messages that should be sent in
response to processing a command.
The server backend sends these messages to inform clients of relevant
events in their channels. For instance, many chat services
inform you when someone has been removed from a chat that you're in.
You do not need to modify this file, but you will need to read and understand
how it works to complete the assignment.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addMessage
(Response response) Add a response to the setstatic ResponseSet
empty()
Convenience method for creating an empty response set.boolean
You should not call this method yourself.int
hashCode()
static ResponseSet
singleMessage
(Response response) Convenience method for sending a single response.toString()
-
Constructor Details
-
ResponseSet
public ResponseSet()
-
-
Method Details
-
addMessage
Add a response to the set- Parameters:
response
- The response to send
-
empty
Convenience method for creating an empty response set.- Returns:
- an empty response set
-
singleMessage
Convenience method for sending a single response.- Parameters:
response
- the response to send- Returns:
- response that contains only that response
-
getResponses
You should not call this method yourself. Associates the stored responses with the userIds of the recipients. This * function will be called by theServerBackend
before dispatching theResponseSet
.- Returns:
- a mapping from userId to a list of response strings that should be
delivered by the
ServerBackend
-
equals
-
hashCode
public int hashCode() -
toString
-