Class GameInfo

java.lang.Object
it.polimi.ingsw.eriantys.controller.GameInfo
All Implemented Interfaces:
Serializable

public class GameInfo extends Object implements Serializable
This class contains all the relevant information about a Game. Objects of this class are meant to be included in messages between the server and the clients in order to provide updates about the game lobby, and to be used by classes which need information about the game object.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    GameInfo(int gameId, String creator, int lobbySize, boolean expertMode)
    Constructs an instance of GameInfo with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the creator of the referenced game.
    int
    Returns the number of players currently participating in the referenced game.
    int
    Returns the id of the referenced game.
    int
    Returns the number of players expected to participate in the referenced game.
    boolean
    Returns true if and only if the game is in expert mode.
    void
    setCurrentPlayers(int currentPlayers)
    Sets the number of players currently participating in the referenced game to the specified value.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • GameInfo

      public GameInfo(int gameId, String creator, int lobbySize, boolean expertMode)
      Constructs an instance of GameInfo with the specified parameters.
      Parameters:
      gameId - the id of the referenced Game.
      creator - the creator of the referenced game.
      lobbySize - the number of players expected to participate in the referenced game.
      expertMode - a flag specifying whether the referenced game is in expert mode.
  • Method Details

    • getGameId

      public int getGameId()
      Returns the id of the referenced game.
      Returns:
      the id of the referenced game.
    • getLobbySize

      public int getLobbySize()
      Returns the number of players expected to participate in the referenced game.
      Returns:
      the number of players expected to participate in the referenced game.
    • getCurrentPlayers

      public int getCurrentPlayers()
      Returns the number of players currently participating in the referenced game.
      Returns:
      the number of players currently participating in the referenced game.
    • setCurrentPlayers

      public void setCurrentPlayers(int currentPlayers)
      Sets the number of players currently participating in the referenced game to the specified value.
      Parameters:
      currentPlayers - the new value for the current players.
    • isExpertMode

      public boolean isExpertMode()
      Returns true if and only if the game is in expert mode.
      Returns:
      true if and only if the game is in expert mode.
    • getCreator

      public String getCreator()
      Returns the creator of the referenced game.
      Returns:
      the creator of the referenced game.
    • toString

      public String toString()
      Overrides:
      toString in class Object