Package org.cis1200

Class MessageCommand

java.lang.Object
org.cis1200.Command
org.cis1200.MessageCommand

class MessageCommand extends Command
Represents a Command issued by a client to send a message to all other clients in the channel.
  • Constructor Details

    • MessageCommand

      public MessageCommand(int senderId, String channel, String message)
      Constructor; initializes the private fields of the object.
      Parameters:
      senderId - of this command
      channel - where the user wants to send a message to
      message - text to be sent to all users in the channel
  • Method Details

    • updateServerModel

      public ResponseSet updateServerModel(ServerModel model)
      Description copied from class: Command
      Process the command and update the server model accordingly.
      Specified by:
      updateServerModel in class Command
      Parameters:
      model - An instance of the ServerModel class which represents the current state of the server.
      Returns:
      A ResponseSet object, informing clients about changes resulting from the command.
    • getChannel

      public String getChannel()
      Returns:
      the channel where the message should be sent
    • toString

      public String toString()
      Overrides:
      toString in class Object