client.framework.models
Class Session

java.lang.Object
  extended by client.framework.models.Session

public class Session
extends java.lang.Object

This class is a model representing a session running on the server to which the client is connected. The session consist of an id, a name, a number of connected players, and a maximum number of players.

Author:
Eivind Sorteberg, Martin Jarrett

Constructor Summary
Session(int id, java.lang.String name, int nofPlayers, int maxPlayers)
          Constructor that creates a Session object with the specified attributes.
Session(java.lang.String[] values)
          Creates a new Session object, where the session's attributes are contained in an array.
 
Method Summary
 int getId()
          Returns the session's id.
 int getMaxPlayers()
          Returns the session's maximum number of players.
 java.lang.String getName()
          Returns the session's name.
 int getNofPlayers()
          Returns the session's number of currently connected players.
 java.lang.String toString()
          Returns a string representation of the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Session

public Session(int id,
               java.lang.String name,
               int nofPlayers,
               int maxPlayers)
Constructor that creates a Session object with the specified attributes.

Parameters:
id - The session's id.
name - The session's name.
nofPlayers - The number of currently connected players.
maxPlayers - The maximum number of players.

Session

public Session(java.lang.String[] values)
Creates a new Session object, where the session's attributes are contained in an array.

Parameters:
values - The session's attributes.
See Also:
Session(int, String, int, int)
Method Detail

toString

public java.lang.String toString()
Returns a string representation of the session. This method is used by the SessionView to list the server's active sessions, and their attributes.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the session.

getId

public int getId()
Returns the session's id.

Returns:
The session's id.

getName

public java.lang.String getName()
Returns the session's name.

Returns:
The session's name.

getNofPlayers

public int getNofPlayers()
Returns the session's number of currently connected players.

Returns:
The number of connected players.

getMaxPlayers

public int getMaxPlayers()
Returns the session's maximum number of players. Used to check whether the local player is allowed to connect to the session or not (if it is full).

Returns:
The session's maximum number of players.