public abstract class Command extends Object
Command
abstract class
has a concrete subclass corresponding to each of the possible commands that
can be issued by a client. The protocol specification contains more
information about the expected behavior of various commands.Modifier and Type | Field and Description |
---|---|
protected String |
sender |
protected int |
senderId |
Modifier | Constructor and Description |
---|---|
protected |
Command(int senderId,
String sender) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns
true if two Command s are equal; that is, they
produce the same string representation. |
String |
getSender()
Returns the nickname of the client who issued the
Command . |
int |
getSenderId()
Returns the user ID of the client who issued the
Command . |
abstract Broadcast |
updateServerModel(ServerModel model)
Processes the command and updates the server model accordingly.
|
protected int senderId
protected String sender
protected Command(int senderId, String sender)
public int getSenderId()
Command
.public String getSender()
Command
.public abstract Broadcast updateServerModel(ServerModel model)
model
- An instance of the ServerModelApi
class which
represents the current state of the server.Broadcast
object, informing clients about changes
resulting from the command.