sfs2x.client.entities
Interface Room

All Known Implementing Classes:
SFSRoom

public interface Room

The Room interface defines all the methods and properties that an object representing a SmartFoxServer Room entity exposes.

In the SmartFoxServer 2X client API this interface is implemented by the SFSRoom class. Read the class description for additional informations.

See Also:
SFSRoom

Method Summary
 void addUser(User user)
          *Private*
 boolean containsUser(User user)
          Indicates whether the specified user is currently inside this Room or not.
 boolean containsVariable(java.lang.String name)
          Indicates whether this Room has the specified Room Variable set or not.
 int getCapacity()
          Returns the maximum amount of users, including spectators, that can be contained in this Room.
 java.lang.String getGroupId()
          Returns the Room Group name.
 int getId()
          Indicates the id of this Room.
 int getMaxSpectators()
          Returns the maximum number of spectators allowed in this Room (Game Rooms only).
 int getMaxUsers()
          Returns the maximum number of users allowed in this Room.
 java.lang.String getName()
          Indicates the name of this Room.
 java.util.List<User> getPlayerList()
          Returns a list of User objects representing the players currently inside this Room (Game Rooms only).
 java.util.Map<?,?> getProperties()
          Defines a generic utility object that can be used to store custom Room data.
 IRoomManager getRoomManager()
          A reference to the RoomManager, managing this Room
 int getSpectatorCount()
          Returns the current number of spectators in this Room (Game Rooms only).
 java.util.List<User> getSpectatorList()
          Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).
 User getUserById(int id)
          Retrieves a User object from its id property.
 User getUserByName(java.lang.String name)
          Retrieves a User object from its name property.
 int getUserCount()
          Returns the current number of users in this Room.
 java.util.List<User> getUserList()
          Returns a list of User objects representing all the users currently inside this Room.
 RoomVariable getVariable(java.lang.String name)
          Retrieves a Room Variable from its name.
 java.util.List<RoomVariable> getVariables()
          Retrieves all the Room Variables of this Room.
 boolean isGame()
          Indicates whether this is a Game Room or not.
 boolean isHidden()
          Indicates whether this Room is hidden or not.
 boolean isJoined()
          Indicates whether the client joined this Room or not.
 boolean isManaged()
          *Private*
 boolean isPasswordProtected()
          Indicates whether this Room requires a password to be joined or not.
 void merge(Room anotherRoom)
          *Private*
 void removeUser(User user)
          *Private*
 void setGame(boolean game)
          *Private*
 void setHidden(boolean hidden)
          *Private*
 void setJoined(boolean joined)
          *Private*
 void setManaged(boolean managed)
          *Private*
 void setMaxSpectators(int maxSpectators)
          *Private*
 void setMaxUsers(int maxUsers)
          *Private*
 void setName(java.lang.String name)
          *Private*
 void setPasswordProtected(boolean passwordProtected)
          *Private*
 void setProperties(java.util.Map<?,?> properties)
           
 void setRoomManager(IRoomManager manager)
          *Private*
 void setSpectatorCount(int spectatorCount)
          *Private*
 void setUserCount(int userCount)
          *Private*
 void setVariable(RoomVariable roomVariable)
          *Private*
 void setVariables(java.util.List<? extends RoomVariable> roomVariables)
          *Private*
 

Method Detail

getId

int getId()
Indicates the id of this Room. It is unique and it is generated by the server when the Room is created.


getName

java.lang.String getName()
Indicates the name of this Room. Two Rooms in the same Zone can't have the same name.

NOTE: setting the name property manually has no effect on the server and can disrupt the API functioning. Use the ChangeRoomNameRequest request instead.

See Also:
ChangeRoomNameRequest

setName

void setName(java.lang.String name)
*Private*


getGroupId

java.lang.String getGroupId()
Returns the Room Group name. Each Group is identified by a unique string (its name or id) and it represents a different "container" for Rooms.

Room Groups enable developers to organize Rooms under different types or categories and let clients select only those Groups they are interested in, in order to receive their events only. This is done via the SubscribeRoomGroupRequest and UnsubscribeRoomGroupRequest requests.

Default: default

See Also:
SubscribeRoomGroupRequest, UnsubscribeRoomGroupRequest

isJoined

boolean isJoined()
Indicates whether the client joined this Room or not.

NOTE: setting the isJoined property manually has no effect on the server and can disrupt the API functioning. Use the JoinRoomRequest request to join a new Room instead.

See Also:
JoinRoomRequest

isGame

boolean isGame()
Indicates whether this is a Game Room or not.

NOTE: setting the isGame property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.


isHidden

boolean isHidden()
Indicates whether this Room is hidden or not. This is a utility flag that can be used by developers to hide certain Rooms from the interface of their application.

NOTE: setting the isHidden property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.


isPasswordProtected

boolean isPasswordProtected()
Indicates whether this Room requires a password to be joined or not.

NOTE: setting the isPasswordProtected property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room's password set when the Room is created or by means of the ChangeRoomPasswordStateRequest request.

See Also:
ChangeRoomPasswordStateRequest

setPasswordProtected

void setPasswordProtected(boolean passwordProtected)
*Private*


isManaged

boolean isManaged()
*Private*


getUserCount

int getUserCount()
Returns the current number of users in this Room. In case of Game Rooms, this is the number of players.

NOTE: setting the userCount property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room state.


getMaxUsers

int getMaxUsers()
Returns the maximum number of users allowed in this Room. In case of Game Rooms, this is the maximum number of players.

NOTE: setting the maxUsers property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.


getSpectatorCount

int getSpectatorCount()
Returns the current number of spectators in this Room (Game Rooms only).

NOTE: setting the spectatorCount property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room state.


getMaxSpectators

int getMaxSpectators()
Returns the maximum number of spectators allowed in this Room (Game Rooms only).

NOTE: setting the maxSpectators property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Game Room.


getCapacity

int getCapacity()
Returns the maximum amount of users, including spectators, that can be contained in this Room.


setJoined

void setJoined(boolean joined)
*Private*


setGame

void setGame(boolean game)
*Private*


setHidden

void setHidden(boolean hidden)
*Private*


setManaged

void setManaged(boolean managed)
*Private*


setUserCount

void setUserCount(int userCount)
*Private*


setMaxUsers

void setMaxUsers(int maxUsers)
*Private*


setSpectatorCount

void setSpectatorCount(int spectatorCount)
*Private*


setMaxSpectators

void setMaxSpectators(int maxSpectators)
*Private*


addUser

void addUser(User user)
*Private*


removeUser

void removeUser(User user)
*Private*


containsUser

boolean containsUser(User user)
Indicates whether the specified user is currently inside this Room or not.

Parameters:
user - The User object representing the user whose presence in this Room must be checked.
Returns:
true if the user is inside this Room; false otherwise.

getUserByName

User getUserByName(java.lang.String name)
Retrieves a User object from its name property.

Parameters:
name - The name of the user to be found.
Returns:
The User object representing the user, or null if no user with the passed name exists in this Room.
See Also:
getUserById(int)

getUserById

User getUserById(int id)
Retrieves a User object from its id property.

Parameters:
id - The id of the user to be found.
Returns:
The User object representing the user, or null if no user with the passed id exists in this Room.
See Also:
getUserByName(String)

getUserList

java.util.List<User> getUserList()
Returns a list of User objects representing all the users currently inside this Room.


getPlayerList

java.util.List<User> getPlayerList()
Returns a list of User objects representing the players currently inside this Room (Game Rooms only).


getSpectatorList

java.util.List<User> getSpectatorList()
Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).


getVariable

RoomVariable getVariable(java.lang.String name)
Retrieves a Room Variable from its name.

Parameters:
name - The name of the Room Variable to be retrieved.
Returns:
The RoomVariable object representing the Room Variable, or null if no Room Variable with the passed name exists in this Room.
See Also:
getVariables(), SetRoomVariablesRequest

getVariables

java.util.List<RoomVariable> getVariables()
Retrieves all the Room Variables of this Room.

Returns:
The list of RoomVariable objects associated with this Room.
See Also:
RoomVariable, getVariable(String)

setVariable

void setVariable(RoomVariable roomVariable)
*Private*


setVariables

void setVariables(java.util.List<? extends RoomVariable> roomVariables)
*Private*


containsVariable

boolean containsVariable(java.lang.String name)
Indicates whether this Room has the specified Room Variable set or not.

Parameters:
name - The name of the Room Variable whose existance in this Room must be checked.
Returns:
true if a Room Variable with the passed name exists in this Room.

getProperties

java.util.Map<?,?> getProperties()
Defines a generic utility object that can be used to store custom Room data. The values added to this object are for client-side use only and are never transmitted to the server or to the other clients.


setProperties

void setProperties(java.util.Map<?,?> properties)

getRoomManager

IRoomManager getRoomManager()
A reference to the RoomManager, managing this Room


setRoomManager

void setRoomManager(IRoomManager manager)
                    throws com.smartfoxserver.v2.exceptions.SFSException
*Private*

Throws:
com.smartfoxserver.v2.exceptions.SFSException

merge

void merge(Room anotherRoom)
*Private*