diff options
Diffstat (limited to 'src/jrummikub/util')
-rw-r--r-- | src/jrummikub/util/GameData.java | 81 | ||||
-rw-r--r-- | src/jrummikub/util/LoginData.java | 35 |
2 files changed, 116 insertions, 0 deletions
diff --git a/src/jrummikub/util/GameData.java b/src/jrummikub/util/GameData.java new file mode 100644 index 0000000..1ad651f --- /dev/null +++ b/src/jrummikub/util/GameData.java @@ -0,0 +1,81 @@ +package jrummikub.util; + +import java.util.UUID; + +import jrummikub.model.GameSettings; + +/** + * Class summarizing the game data important for unique and sensible network + * representation and use + */ +public class GameData { + private UUID gameID; + private String host; + private GameSettings gameSettings; + + /** + * Creates new game data + * + * @param gameID + * unique gameID + * @param settings + * game settings (serialized) + */ + public GameData(UUID gameID, GameSettings settings) { + this(gameID, settings, null); + } + + /** + * Creates new game data + * + * @param gameID + * unique gameID + * @param settings + * game settings (serialized) + * @param host + * name of the player offering the game + */ + public GameData(UUID gameID, GameSettings settings, String host) { + this.gameID = gameID; + this.gameSettings = settings; + this.host = host; + + } + + /** + * Sets the game settings + * + * @param settings + * game settings after adjustment + */ + public void setGameSettings(GameSettings settings) { + gameSettings = settings; + } + + /** + * Getter for game settings + * + * @return returns game settings + */ + public GameSettings getGameSettings() { + return gameSettings; + } + + /** + * Getter for host name + * + * @return host user name + */ + public String getHost() { + return host; + } + + /** + * Getter for gameID + * + * @return gameID + */ + public UUID getGameID() { + return gameID; + } +}
\ No newline at end of file diff --git a/src/jrummikub/util/LoginData.java b/src/jrummikub/util/LoginData.java index fb295c1..50ae468 100644 --- a/src/jrummikub/util/LoginData.java +++ b/src/jrummikub/util/LoginData.java @@ -1,11 +1,26 @@ package jrummikub.util; +/** + * Data needed for the login in one data type (name, server, password, channel) + */ public class LoginData { private String userName; private String serverName; private String password; private String channelName; + /** + * Creates a new set of login data + * + * @param userName + * user name in channel, player name in game + * @param serverName + * server of the user account specified in user name + * @param password + * for account with user name on server + * @param channelName + * channel in which games can be offered and played + */ public LoginData(String userName, String serverName, String password, String channelName) { this.userName = userName; @@ -14,18 +29,38 @@ public class LoginData { this.channelName = channelName; } + /** + * Getter for user name + * + * @return user name + */ public String getUserName() { return userName; } + /** + * Getter for server name + * + * @return server name + */ public String getServerName() { return serverName; } + /** + * Getter for password + * + * @return password + */ public String getPassword() { return password; } + /** + * Getter for channel name + * + * @return channel name + */ public String getChannelName() { return channelName; } |