ServerModel
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 | Description |
---|---|---|
Broadcast |
deregisterUser(int userId) |
Informs the model that the client with the given user ID has disconnected from the server.
|
java.util.Collection<java.lang.String> |
getChannels() |
Gets a collection of the names of all the channels that are present on the server.
|
java.lang.String |
getNickname(int userId) |
Gets the nickname currently associated with the given user ID.
|
java.lang.String |
getOwner(java.lang.String channelName) |
Gets the nickname of the owner of the given channel.
|
java.util.Collection<java.lang.String> |
getRegisteredUsers() |
Gets a collection of the nicknames of all users who are registered with the server.
|
int |
getUserId(java.lang.String nickname) |
Gets the user ID currently associated with the given nickname.
|
java.util.Collection<java.lang.String> |
getUsersInChannel(java.lang.String channelName) |
Gets 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()
.userId
- The unique ID of the user to deregisterBroadcast
instructing clients to remove the user from all channelsint getUserId(java.lang.String nickname)
nickname
- The nickname for which to get the associated user IDjava.lang.String getNickname(int userId)
userId
- The user ID for which to get the associated nicknamejava.util.Collection<java.lang.String> getRegisteredUsers()
java.util.Collection<java.lang.String> getChannels()
java.util.Collection<java.lang.String> getUsersInChannel(java.lang.String channelName)
channelName
- The channel for which to get member nicknamesjava.lang.String getOwner(java.lang.String channelName)
null
if no
channel with the given name exists.
This method is provided for testing.channelName
- The channel for which to get the owner nickname