public abstract class Command
extends java.lang.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 | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object o) |
Returns
true if two Command s are equal; that is, if
they produce the same string representation. |
java.lang.String |
getSender() |
Gets the nickname of the client who issued the
Command . |
int |
getSenderId() |
Gets the user ID of the client who issued the
Command . |
abstract Broadcast |
updateServerModel(ServerModel model) |
Processes the command and updates the server model accordingly.
|
public int getSenderId()
Command
.public java.lang.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.public boolean equals(java.lang.Object o)
true
if two Command
s are equal; that is, if
they produce the same string representation.
Note that all subclasses of Command
must override their
toString
method appropriately for this definition to make sense.
(We have done this for you below).equals
in class java.lang.Object
o
- the object to compare with this
for equality