Package org.cis1200

Class ResponseSet

java.lang.Object
org.cis1200.ResponseSet

public final class ResponseSet extends Object
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 Details

    • ResponseSet

      public ResponseSet()
  • Method Details

    • addMessage

      public boolean addMessage(Response response)
      Add a response to the set
      Parameters:
      response - The response to send
    • empty

      public static ResponseSet empty()
      Convenience method for creating an empty response set.
      Returns:
      an empty response set
    • singleMessage

      public static ResponseSet singleMessage(Response response)
      Convenience method for sending a single response.
      Parameters:
      response - the response to send
      Returns:
      response that contains only that response
    • getResponses

      public Set<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 the ServerBackend before dispatching the ResponseSet.
      Returns:
      a mapping from userId to a list of response strings that should be delivered by the ServerBackend
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object