diff --git a/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java b/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java index 556e97f..b89a9f1 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java +++ b/src/main/java/it/polimi/ingsw/gc14/Controller/GameController.java @@ -119,6 +119,13 @@ public class GameController { return model.DrawLowerBuildingCardByIndex(model.getPlayerByUsername(playerUsername), pos); } + /** + * Skips the upper card drawing action for the specified player. + * + * @param playerUsername the username of the player who wants to skip the upper drawing action. + * @return {@code true} if the skip action is valid and successfully performed; + * {@code false} if the player does not exist or the action is not valid. + */ public boolean SkipUpperDrawing(String playerUsername) { Player player= model.getPlayerByUsername(playerUsername); if(player==null) @@ -126,6 +133,13 @@ public class GameController { return model.SkipUpperDrawing(model.getPlayerByUsername(playerUsername)); } + /** + * Skips the lower card drawing action for the specified player. + * + * @param playerUsername the username of the player who wants to skip the lower drawing action. + * @return {@code true} if the skip action is valid and successfully performed; + * {@code false} if the player does not exist or the action is not valid. + */ public boolean SkipLowerDrawing(String playerUsername) { Player player= model.getPlayerByUsername(playerUsername); if(player==null) diff --git a/src/main/java/it/polimi/ingsw/gc14/HelloApplication.java b/src/main/java/it/polimi/ingsw/gc14/HelloApplication.java index 02cb052..4823506 100644 --- a/src/main/java/it/polimi/ingsw/gc14/HelloApplication.java +++ b/src/main/java/it/polimi/ingsw/gc14/HelloApplication.java @@ -7,7 +7,17 @@ import javafx.stage.Stage; import java.io.IOException; +/** + * JavaFX application entry point used to start the graphical interface. + */ public class HelloApplication extends Application { + + /** + * Starts the JavaFX application and loads the initial FXML view. + * + * @param stage the primary stage of the application. + * @throws IOException if the FXML file cannot be loaded. + */ @Override public void start(Stage stage) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); diff --git a/src/main/java/it/polimi/ingsw/gc14/HelloController.java b/src/main/java/it/polimi/ingsw/gc14/HelloController.java index 6ff94b1..43f007a 100644 --- a/src/main/java/it/polimi/ingsw/gc14/HelloController.java +++ b/src/main/java/it/polimi/ingsw/gc14/HelloController.java @@ -3,10 +3,16 @@ package it.polimi.ingsw.gc14; import javafx.fxml.FXML; import javafx.scene.control.Label; +/** + * Controller for the initial JavaFX view. + */ public class HelloController { @FXML private Label welcomeText; + /** + * Handles the click on the hello button. + */ @FXML protected void onHelloButtonClick() { welcomeText.setText("Welcome to JavaFX Application!"); diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/BuildingEffect.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/BuildingEffect.java index 967136a..bcbe693 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/BuildingEffect.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/BuildingEffect.java @@ -2,6 +2,18 @@ package it.polimi.ingsw.gc14.Model.Cards.Building; import it.polimi.ingsw.gc14.Model.Player; +/** + * Defines the effect behavior of a building card. + * + *
Classes implementing this interface provide the specific effect + * applied to a player when the building card is activated. + */ public interface BuildingEffect { - public void applyEffect(Player player); + + /** + * Applies the building effect to the specified player. + * + * @param player the player affected by the building effect. + */ + void applyEffect(Player player); } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/EffectType.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/EffectType.java index c8ddda2..eaa48f1 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/EffectType.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/EffectType.java @@ -1,5 +1,10 @@ package it.polimi.ingsw.gc14.Model.Cards.Building; +/** + * Represents the possible effect types of building cards. + /** + * Represents the possible effect types of building cards. + */ public enum EffectType { FINAL, CARD_SET, INVENTOR_PAIR, ON_EVENT, ON_END_TURN, ON_ROUND_END } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java index 6e3e0a5..883de4c 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building10.java @@ -7,6 +7,11 @@ import it.polimi.ingsw.gc14.Model.Player; import java.util.HashMap; +/** + * Represents the building card number 10. + * + *
This class defines the specific behavior and effects of building card 10. + */ public class Building10 extends BuildingCard { /** diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java index eefff8a..9f2df2b 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building11.java @@ -5,6 +5,11 @@ import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents the building card number 11. + * + *
This class defines the specific behavior and effects of building card 11. + */ public class Building11 extends BuildingCard { /** diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java index 9c049dd..049925f 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/Building/Effects/Building13.java @@ -4,7 +4,13 @@ import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType; import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents the building card number 13. + * + *
This class defines the specific behavior and effects of building card 13. + */ public class Building13 extends BuildingCard{ + /** * Creates a Building13 card with the specified era, price, and prestige value. * diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java index 24e41a1..fa997e1 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/BuildingCard.java @@ -6,8 +6,16 @@ import it.polimi.ingsw.gc14.Model.PlayableCard; import it.polimi.ingsw.gc14.Model.Player; import java.io.Serializable; -import java.util.ArrayList; + +/** + * Represents a generic building card in the game. + * + *
A building card is a playable card with a price and a specific building + * effect. Concrete building cards extend this class to define their own + * behavior. + */ public class BuildingCard extends PlayableCard implements Cloneable , BuildingEffect, Serializable { + /** * The price of this building card. */ diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/CharacterType.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/CharacterType.java index 5df0d9e..d05a6e6 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/CharacterType.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/CharacterType.java @@ -1,5 +1,10 @@ package it.polimi.ingsw.gc14.Model.Cards.TribeCards; +/** + * Represents the different types of character cards available in the game. + /** + * Represents the different types of character cards available in the game. + */ public enum CharacterType { INVENTOR, BUILDER, GATHERER, ARTIST, SHAMAN, HUNTER } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java index 8276fb0..4dceff7 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Artist.java @@ -4,12 +4,18 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents an Artist character card. + * + *
An Artist is a specific type of {@link Character} initialized with + * {@link CharacterType#ARTIST}. + */ public class Artist extends Character { /** * Creates an Artist character card with the specified era. * - * @param Era the era of the Artist card + * @param Era the era of the Artist card. */ public Artist(int Era) { super(Era, CharacterType.ARTIST); @@ -18,8 +24,8 @@ public class Artist extends Character { /** * Creates an Artist character card with the specified Era and minimum number of players required to play it. * - * @param Era the era of the Artist card - * @param nMin the minimum number of players required for the card + * @param Era the era of the Artist card. + * @param nMin the minimum number of players required for the card. */ public Artist(int Era,int nMin) { super(Era, CharacterType.ARTIST,nMin); diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java index 0204d5f..9089088 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Builder.java @@ -4,7 +4,14 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents a Builder character card. + * + *
A Builder is a specific type of {@link Character} that provides + * a reduction value when buying building cards. + */ public class Builder extends Character { + /** * The reduction value provided by this Builder card. */ diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java index 9c438a6..d0e8187 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Gatherer.java @@ -4,7 +4,14 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents a Gatherer character card. + * + *
A Gatherer is a specific type of {@link Character} initialized with + * {@link CharacterType#GATHERER}. + */ public class Gatherer extends Character { + /** * Creates a Gatherer character card with the specified era. * diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java index 5fd0d9a..b60d40a 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Hunter.java @@ -4,6 +4,12 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents a Hunter character card. + * + *
A Hunter is a specific type of {@link Character} initialized with + * {@link CharacterType#HUNTER}. + */ public class Hunter extends Character { /** diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java index 083359d..5d21c71 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Inventor.java @@ -3,6 +3,12 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents an Inventor character card. + * + *
An Inventor is a specific type of {@link Character} initialized with + * {@link CharacterType#INVENTOR}. + */ public class Inventor extends Character { /** * The {@code Icons}'s ID. There are a total of 10 different Icons. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java index 2b3f5cc..7352819 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Characters/Shaman.java @@ -1,10 +1,15 @@ package it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters; -import it.polimi.ingsw.gc14.Model.Cards.TribeCard; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character; import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType; import it.polimi.ingsw.gc14.Model.Player; +/** + * Represents a Shaman character card. + * + *
A Shaman is a specific type of {@link Character} initialized with + * {@link CharacterType#SHAMAN}. + */ public class Shaman extends Character { /** * The number of star {@code Icons} the card possesses. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventType.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventType.java index f0e5a08..c07f869 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventType.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/EventType.java @@ -1,5 +1,10 @@ package it.polimi.ingsw.gc14.Model.Cards.TribeCards; +/** + * Represents the different types of event cards available in the game. + /** + * Represents the different types of event cards available in the game. + */ public enum EventType { SUSTENANCE, SHAMANIC_RITUAL, CAVE_PAINTINGS, HUNT } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java index 16d7395..2e18de0 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java @@ -10,6 +10,11 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard; import it.polimi.ingsw.gc14.Model.Player; import java.util.ArrayList; +/** + * Represents a Cave Paintings event card. + * + *
This class defines the specific behavior of the Cave Paintings event.
+ */
public class CavePaintings extends EventCard {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java
index 090b3bd..4bf1e52 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Hunt.java
@@ -36,9 +36,9 @@ public class Hunt extends EventCard {
* Each player takes 1 Food and gains Prestige Points for each Hunter in their tribe.
*
* Buildings influence:
- * Building 7: you take 1 Food and 1 additional Prestige Point for each Hunter
+ * Building 7: the player takes 1 Food and 1 additional Prestige Point for each Hunter.
*
- * @param playerList contains all the players in the game
+ * @param playerList the list of all players in the game.
*/
@Override
public void activateEvent (ArrayList This class defines the specific behavior of the Sustenance event.
+ */
public class Sustenance extends EventCard {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java
index 465da3e..db8fc1a 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java
@@ -28,12 +28,20 @@ import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
*/
public class Game implements Serializable {
+ /**
+ * List of observers registered to receive updates when the game state changes.
+ *
+ * The list is marked as {@code transient} because observers should not be
+ * serialized with the game model.
+ */
private transient List An order logic card manages the turn order of the players and defines
+ * the behavior used to update the order during the game.
+ */
public abstract class OrderLogicCard implements Serializable {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java
index ced283e..2a0868b 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order2.java
@@ -8,6 +8,12 @@ import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
import java.util.*;
import java.util.stream.IntStream;
+/**
+ * Represents the order logic card used in a two-player game.
+ *
+ * This class defines the specific turn-order behavior for games with
+ * two players.
+ */
public class Order2 extends OrderLogicCard {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java
index b3e1247..95b3713 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order3.java
@@ -9,6 +9,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
+/**
+ * Represents the order logic card used in a three-player game.
+ *
+ * This class defines the specific turn-order behavior for games with
+ * three players.
+ */
public class Order3 extends OrderLogicCard {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java
index 20b573b..2617845 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order4.java
@@ -9,6 +9,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
+/**
+ * Represents the order logic card used in a four-player game.
+ *
+ * This class defines the specific turn-order behavior for games with
+ * four players.
+ */
public class Order4 extends OrderLogicCard {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java
index e8ea88f..5b3b843 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/Order5.java
@@ -9,6 +9,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
+/**
+ * Represents the order logic card used in a five-player game.
+ *
+ * This class defines the specific turn-order behavior for games with
+ * five players.
+ */
public class Order5 extends OrderLogicCard {
/**
diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java
index 8d3b299..67bb635 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Model/Orders/OrderPlayer.java
@@ -5,24 +5,43 @@ import it.polimi.ingsw.gc14.Model.Player;
import java.io.Serializable;
/**
- * Abstract base class for all order {@code logic cards}.
- * An {@code OrderLogicCard} manages a queue of {@code players} and defines the effects
- * applied when they are pushed back into the queue.
- * @see it.polimi.ingsw.gc14.Model.Player Player
+ * Represents a player entry in an order logic card.
+ *
+ * Each entry stores the player and whether that player has already
+ * performed an action in the current order sequence.
*/
public class OrderPlayer implements Serializable {
+
+ /**
+ * The player associated with this order entry.
+ */
public Player player;
+
+ /**
+ * Indicates whether the player has already played.
+ */
public boolean played;
- public OrderPlayer(Player player,boolean played){
- this.player=player;
- this.played=played;
+
+ /**
+ * Creates an order entry for the specified player.
+ *
+ * @param player the player associated with this order entry.
+ * @param played {@code true} if the player has already played;
+ * {@code false} otherwise.
+ */
+ public OrderPlayer(Player player, boolean played) {
+ this.player = player;
+ this.played = played;
}
/**
- * @return the string containing the username and whether it played or not.
+ * Returns a string containing the player's username and whether the player
+ * has already played.
+ *
+ * @return the string containing the username and whether the player has played.
*/
@Override
public String toString() {
- return player.getUserName()+" "+played;
+ return player.getUserName() + " " + played;
}
}
diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java b/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java
index 33d5efb..de8cc3d 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java
@@ -1,5 +1,16 @@
package it.polimi.ingsw.gc14.Network;
+/**
+ * Represents the possible actions requested by a client and handled by the
+ * server during the game.
+ *
+ * Each value identifies a specific user action, such as adding a player,
+ * choosing a slot, drawing a card, picking an optional card, or skipping an
+ * optional action.
+ /**
+ * Represents the different types of network events that can be sent between
+ * client and server.
+ */
public enum EventType {
ADD_PLAYER,
SLOT_CHOICE,
diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java
index c7fa94d..c44c309 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java
@@ -6,7 +6,28 @@ import it.polimi.ingsw.gc14.Network.NetworkEvent;
import java.io.Serializable;
import java.rmi.*;
+/**
+ * Callback interface used by the server to notify an RMI client about
+ * game updates and incoming network actions.
+ *
+ * Implementations of this interface are remotely accessible and
+ * serializable.
+ */
public interface IClientCallback extends Remote, Serializable {
+
+ /**
+ * Notifies the client that the game model has been initialized or updated.
+ *
+ * @param model the current game model.
+ * @throws RemoteException if an RMI communication error occurs.
+ */
void onGameInit(Game model) throws RemoteException;
+
+ /**
+ * Notifies the client about a network action to process.
+ *
+ * @param action the network event received from the server.
+ * @throws RemoteException if an RMI communication error occurs.
+ */
void onAction(NetworkEvent action) throws RemoteException;
}
\ No newline at end of file
diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java
index 7a1ef25..24fcdce 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java
@@ -4,9 +4,31 @@ import it.polimi.ingsw.gc14.Network.NetworkEvent;
import java.rmi.*;
+/**
+ * Remote interface used by RMI clients to interact with the game server.
+ */
public interface IGameServer extends Remote {
+ /**
+ * Adds a player to the game through the remote server.
+ *
+ * @param username the username of the player joining the game.
+ * @param preferredInt the preferred player number or slot selected by the client.
+ * @param callback the client callback used by the server to send updates.
+ * @return {@code true} if the player successfully joins the game;
+ * {@code false} otherwise.
+ * @throws RemoteException if an RMI communication error occurs.
+ */
boolean joinGame(String username,int preferredInt, IClientCallback callback) throws RemoteException;
+
+ /**
+ * Sends a network event to the game server.
+ *
+ * @param event the event to be processed by the server.
+ * @return {@code true} if the event is accepted and processed;
+ * {@code false} otherwise.
+ * @throws RemoteException if an RMI communication error occurs.
+ */
boolean doEvent(NetworkEvent event) throws RemoteException;
}
diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/ClientHandler.java b/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/ClientHandler.java
index 539416e..893a303 100644
--- a/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/ClientHandler.java
+++ b/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/ClientHandler.java
@@ -37,9 +37,12 @@ public class ClientHandler implements Runnable {
/**
* Class constructor that initializes the attributes.
- * @param clientSocket The socket representing the client's TCP connection
- * @param clientHandlers The shared list of all active client handlers
- * @param actionQueue The queue containing incoming events
+ *
+ * @param clientSocket the socket representing the client's TCP connection.
+ * @param out the output stream used to send data to the client.
+ * @param in the input stream used to receive data from the client.
+ * @param clientHandlers the shared list of all active client handlers.
+ * @param actionQueue the queue containing incoming events.
*/
public ClientHandler(Socket clientSocket, ObjectOutputStream out, ObjectInputStream in, List Each style stores the characters needed to draw table corners,
+ * horizontal and vertical lines, and junctions.
+ */
public enum BorderStyle {
+
+ /**
+ * Unicode box-drawing border style.
+ */
UNICODE("╔","╗","╚","╝","═","║","╠","╣","╦","╩","╬","├","┤","─","┼"),
+
+ /**
+ * Plain ASCII border style.
+ */
ASCII ("+","+","+","+","-","|","+","+","+","+","+","+","+","-","+"),
+
+ /**
+ * Rounded Unicode border style.
+ */
ROUNDED("╭","╮","╰","╯","─","│","├","┤","┬","┴","┼","├","┤","─","┼");
private final String tl,tr,bl,br,h,v,ml,mr,mt,mb,x,sl,sr,sh,sx;
@@ -21,19 +40,78 @@ public enum BorderStyle {
this.sh = sh; this.sx = sx;
}
+ /**
+ * @return the top-left corner character.
+ */
public String tl() { return tl; }
+
+ /**
+ * @return the top-right corner character.
+ */
public String tr() { return tr; }
+
+ /**
+ * @return the bottom-left corner character.
+ */
public String bl() { return bl; }
+
+ /**
+ * @return the bottom-right corner character.
+ */
public String br() { return br; }
+
+ /**
+ * @return the horizontal line character.
+ */
public String h() { return h; }
+
+ /**
+ * @return the vertical line character.
+ */
public String v() { return v; }
+
+ /**
+ * @return the middle-left junction character.
+ */
public String ml() { return ml; }
+
+ /**
+ * @return the middle-right junction character.
+ */
public String mr() { return mr; }
+
+ /**
+ * @return the top-middle junction character.
+ */
public String mt() { return mt; }
+
+ /**
+ * @return the bottom-middle junction character.
+ */
public String mb() { return mb; }
+
+ /**
+ * @return the center junction character.
+ */
public String x() { return x; }
+
+ /**
+ * @return the separator-left junction character.
+ */
public String sl() { return sl; }
+
+ /**
+ * @return the separator-right junction character.
+ */
public String sr() { return sr; }
+
+ /**
+ * @return the separator horizontal line character.
+ */
public String sh() { return sh; }
+
+ /**
+ * @return the separator center junction character.
+ */
public String sx() { return sx; }
}