public interface ServerModelApi
ServerModel
class. These methods will be used by the ServerBackend
,
and should therefore conform to this interface.
You do not need to modify this file.Modifier and Type | Method and Description |
---|---|
Broadcast |
deregisterUser(int userId)
Informs the model that the client with the given user ID has
disconnected from the server.
|
Collection<String> |
getChannels()
Returns a collection of the names of all the channels that are present
on the server.
|
String |
getNickname(int userId)
Returns the nickname currently associated with the given user ID.
|
String |
getOwner(String channelName)
Returns the nickname of the owner of the current channel.
|
Collection<String> |
getRegisteredUsers()
Returns a collection of the nicknames of all users that are registered
with the server.
|
int |
getUserId(String nickname)
Returns the user ID currently associated with the given nickname.
|
Collection<String> |
getUsers(String channelName)
Returns a collection of the nicknames of all the users in a given
channel.
|
Broadcast |
registerUser(int userId)
Informs the model that a client has connected to the server with the
given user ID.
|
Broadcast registerUser(int userId)
getRegisteredUsers()
.userId
- the unique ID created by the backend to represent this userBroadcast
to the user with their new nicknameBroadcast deregisterUser(int userId)
getRegisteredUsers()
. The behavior of this method if
the given user ID is not registered with the model is undefined.userId
- the unique ID created by the backend to represent this userBroadcast
instructing clients to remove
the user from all channels.int getUserId(String nickname)
nickname
- The user's nicknameString getNickname(int userId)
userId
- The ID whose nickname to return.Collection<String> getRegisteredUsers()
Collection<String> getChannels()
Collection<String> getUsers(String channelName)
channelName
- The channel whose member nicknames should be returnedString getOwner(String channelName)
null
if no channel with the given name exists. Provided for
testing.channelName
- The channel whose owner nickname should be returned