From a25218af09eb0edf73e33417d22b316407a1f824 Mon Sep 17 00:00:00 2001 From: MatteoPellegrino05 Date: Sun, 12 Apr 2026 19:15:17 +0200 Subject: [PATCH 1/5] Add: JavaDoc for Order2 --- .../polimi/ingsw/gc14/Model/Orders/Order2.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 ffbf893..e27dc37 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 @@ -7,12 +7,30 @@ import it.polimi.ingsw.gc14.Model.Player; import java.util.*; public class Order2 extends OrderLogicCard { + + /** + * Creates an Order2 logic card for a two-player game. + * + * @param players the list of players associated with this order card + * @throws NoSuchElementException if the number of players is not equal to 2 + */ public Order2(ArrayList players)throws NoSuchElementException { if(players.size()!=2) throw new NoSuchElementException(); super(players); } + + /** + * Applies the effect associated with the specified position index for the given player. + * If {@code index == 0}, the player gains 1 Food and the building effect is applied. + * If {@code index == 1}, the player tries to remove 1 Food; if the player cannot remove it, + * the player loses 2 Prestige. + * + * @param player the player to whom the effect is applied + * @param index the position index of the effect to apply + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 2} + */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException { From a2d9c964f5347271593835ff4b9dd585a1bb2cdd Mon Sep 17 00:00:00 2001 From: MatteoPellegrino05 Date: Sun, 12 Apr 2026 19:20:12 +0200 Subject: [PATCH 2/5] Add: JavaDoc for Order3 --- .../polimi/ingsw/gc14/Model/Orders/Order3.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 f0144fb..81ec8a0 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 @@ -7,11 +7,29 @@ import java.util.ArrayList; import java.util.NoSuchElementException; public class Order3 extends OrderLogicCard { + + /** + * Creates an Order3 logic card for a three-player game. + * + * @param players the list of players associated with this order card + * @throws NoSuchElementException if the number of players is not equal to 3 + */ public Order3(ArrayList players) throws NoSuchElementException{ if(players.size()!=3) throw new NoSuchElementException(); super(players); } + + /** + * Applies the effect associated with the specified position index for the given player. + * If {@code index == 0}, the player gains 2 Food and the building effect is applied. + * If {@code index == 1}, no effect is applied. + * If {@code index == 2}, if the player can remove 1 Food, the player loses 2 Prestige. + * + * @param player the player to whom the effect is applied + * @param index the position index of the effect to apply + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 3} + */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException { From bce2db6d3b419f1911ab11a2e52ce9aa30cdd174 Mon Sep 17 00:00:00 2001 From: MatteoPellegrino05 Date: Sun, 12 Apr 2026 19:30:54 +0200 Subject: [PATCH 3/5] Add: JavaDoc for Order4 --- .../ingsw/gc14/Model/Orders/Order4.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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 afde765..d28acfb 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 @@ -7,11 +7,31 @@ import java.util.ArrayList; import java.util.NoSuchElementException; public class Order4 extends OrderLogicCard { + + /** + * Creates an Order4 logic card for a four-player game. + * + * @param players the list of players associated with this order card + * @throws NoSuchElementException if the number of players is not equal to 4 + */ public Order4(ArrayList players)throws NoSuchElementException { if(players.size()!=4) throw new NoSuchElementException(); super(players); } + + /** + * Applies the effect associated with the specified position index for the given player. + * If {@code index == 0}, the player gains 2 Food and the building effect is applied. + * If {@code index == 1}, the player gains 1 Food and the building effect is applied. + * If {@code index == 2}, no effect is applied. + * If {@code index == 3}, the player tries to remove 1 Food; if the removal succeeds, + * the player loses 2 Prestige. + * + * @param player the player to whom the effect is applied + * @param index the position index of the effect to apply + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 4} + */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException { From 4db74976c163cb33e92b2aa2458dbd9d2f0dc561 Mon Sep 17 00:00:00 2001 From: MatteoPellegrino05 Date: Sun, 12 Apr 2026 19:31:41 +0200 Subject: [PATCH 4/5] Add: JavaDoc for Order5 --- .../ingsw/gc14/Model/Orders/Order5.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 0f5f5dc..364d1e6 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 @@ -7,11 +7,32 @@ import java.util.ArrayList; import java.util.NoSuchElementException; public class Order5 extends OrderLogicCard { + + /** + * Creates an Order5 logic card for a five-player game. + * + * @param players the list of players associated with this order card + * @throws NoSuchElementException if the number of players is not equal to 5 + */ public Order5(ArrayList players) throws NoSuchElementException{ if(players.size()!=5) throw new NoSuchElementException(); super(players); } + + /** + * Applies the effect associated with the specified position index for the given player. + * If {@code index == 0}, the player gains 3 Food and the building effect is applied. + * If {@code index == 1}, the player gains 1 Food and the building effect is applied. + * If {@code index == 2}, no effect is applied. + * If {@code index == 3}, no effect is applied. + * If {@code index == 4}, the player tries to remove 1 Food; if the removal succeeds, + * the player loses 2 Prestige. + * + * @param player the player to whom the effect is applied + * @param index the position index of the effect to apply + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 5} + */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException { From 6ff5ca00aa3001bad7a8c175d4035022b83e6651 Mon Sep 17 00:00:00 2001 From: GabrieleRadice <265572328+GabrieleRadice@users.noreply.github.com> Date: Sun, 12 Apr 2026 19:45:47 +0200 Subject: [PATCH 5/5] Fix: Fixed Typos In Order2.java, Order3.java, Order4.java, Order5.java. --- .../ingsw/gc14/Model/Orders/Order2.java | 16 +++++++------- .../ingsw/gc14/Model/Orders/Order3.java | 17 +++++++-------- .../ingsw/gc14/Model/Orders/Order4.java | 19 ++++++++--------- .../ingsw/gc14/Model/Orders/Order5.java | 21 +++++++++---------- 4 files changed, 34 insertions(+), 39 deletions(-) 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 e27dc37..1288aee 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 @@ -1,6 +1,5 @@ package it.polimi.ingsw.gc14.Model.Orders; -import it.polimi.ingsw.gc14.Model.Cards.BuildingCard; import it.polimi.ingsw.gc14.Model.OrderLogicCard; import it.polimi.ingsw.gc14.Model.Player; @@ -11,8 +10,8 @@ public class Order2 extends OrderLogicCard { /** * Creates an Order2 logic card for a two-player game. * - * @param players the list of players associated with this order card - * @throws NoSuchElementException if the number of players is not equal to 2 + * @param players the list of players associated with this order card. + * @throws NoSuchElementException if the number of players is not equal to 2. */ public Order2(ArrayList players)throws NoSuchElementException { if(players.size()!=2) @@ -23,13 +22,13 @@ public class Order2 extends OrderLogicCard { /** * Applies the effect associated with the specified position index for the given player. - * If {@code index == 0}, the player gains 1 Food and the building effect is applied. - * If {@code index == 1}, the player tries to remove 1 Food; if the player cannot remove it, + *

If {@code index == 0}, the player gains 1 Food and the building effect is applied. + *

If {@code index == 1}, the player tries to remove 1 Food; if the player cannot remove it, * the player loses 2 Prestige. * - * @param player the player to whom the effect is applied - * @param index the position index of the effect to apply - * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 2} + * @param player the player to whom the effect is applied. + * @param index the position index of the effect to apply. + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 2}. */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException @@ -47,7 +46,6 @@ public class Order2 extends OrderLogicCard { if(index==1){ if(!player.removeFood(1)){ player.removePrestige(2); - return; } } } 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 81ec8a0..fc7f6d2 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 @@ -11,8 +11,8 @@ public class Order3 extends OrderLogicCard { /** * Creates an Order3 logic card for a three-player game. * - * @param players the list of players associated with this order card - * @throws NoSuchElementException if the number of players is not equal to 3 + * @param players the list of players associated with this order card. + * @throws NoSuchElementException if the number of players is not equal to 3. */ public Order3(ArrayList players) throws NoSuchElementException{ if(players.size()!=3) @@ -22,13 +22,13 @@ public class Order3 extends OrderLogicCard { /** * Applies the effect associated with the specified position index for the given player. - * If {@code index == 0}, the player gains 2 Food and the building effect is applied. - * If {@code index == 1}, no effect is applied. - * If {@code index == 2}, if the player can remove 1 Food, the player loses 2 Prestige. + *

If {@code index == 0}, the player gains 2 Food and the building effect is applied. + *

If {@code index == 1}, no effect is applied. + *

If {@code index == 2}, if the player can remove 1 Food, the player loses 2 Prestige. * - * @param player the player to whom the effect is applied - * @param index the position index of the effect to apply - * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 3} + * @param player the player to whom the effect is applied. + * @param index the position index of the effect to apply. + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 3}. */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException @@ -47,7 +47,6 @@ public class Order3 extends OrderLogicCard { if(player.removeFood(1)){ player.removePrestige(2); } - return; } } } \ No newline at end of file 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 d28acfb..06bb44a 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 @@ -11,8 +11,8 @@ public class Order4 extends OrderLogicCard { /** * Creates an Order4 logic card for a four-player game. * - * @param players the list of players associated with this order card - * @throws NoSuchElementException if the number of players is not equal to 4 + * @param players the list of players associated with this order card. + * @throws NoSuchElementException if the number of players is not equal to 4. */ public Order4(ArrayList players)throws NoSuchElementException { if(players.size()!=4) @@ -22,15 +22,15 @@ public class Order4 extends OrderLogicCard { /** * Applies the effect associated with the specified position index for the given player. - * If {@code index == 0}, the player gains 2 Food and the building effect is applied. - * If {@code index == 1}, the player gains 1 Food and the building effect is applied. - * If {@code index == 2}, no effect is applied. - * If {@code index == 3}, the player tries to remove 1 Food; if the removal succeeds, + *

If {@code index == 0}, the player gains 2 Food and the building effect is applied. + *

If {@code index == 1}, the player gains 1 Food and the building effect is applied. + *

If {@code index == 2}, no effect is applied. + *

If {@code index == 3}, the player tries to remove 1 Food; if the removal succeeds, * the player loses 2 Prestige. * - * @param player the player to whom the effect is applied - * @param index the position index of the effect to apply - * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 4} + * @param player the player to whom the effect is applied. + * @param index the position index of the effect to apply. + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 4}. */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException @@ -55,7 +55,6 @@ public class Order4 extends OrderLogicCard { if(player.removeFood(1)){ player.removePrestige(2); } - return; } } } \ No newline at end of file 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 364d1e6..41b7228 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 @@ -11,8 +11,8 @@ public class Order5 extends OrderLogicCard { /** * Creates an Order5 logic card for a five-player game. * - * @param players the list of players associated with this order card - * @throws NoSuchElementException if the number of players is not equal to 5 + * @param players the list of players associated with this order card. + * @throws NoSuchElementException if the number of players is not equal to 5. */ public Order5(ArrayList players) throws NoSuchElementException{ if(players.size()!=5) @@ -22,16 +22,16 @@ public class Order5 extends OrderLogicCard { /** * Applies the effect associated with the specified position index for the given player. - * If {@code index == 0}, the player gains 3 Food and the building effect is applied. - * If {@code index == 1}, the player gains 1 Food and the building effect is applied. - * If {@code index == 2}, no effect is applied. - * If {@code index == 3}, no effect is applied. - * If {@code index == 4}, the player tries to remove 1 Food; if the removal succeeds, + *

If {@code index == 0}, the player gains 3 Food and the building effect is applied. + *

If {@code index == 1}, the player gains 1 Food and the building effect is applied. + *

If {@code index == 2}, no effect is applied. + *

If {@code index == 3}, no effect is applied. + *

If {@code index == 4}, the player tries to remove 1 Food; if the removal succeeds, * the player loses 2 Prestige. * - * @param player the player to whom the effect is applied - * @param index the position index of the effect to apply - * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 5} + * @param player the player to whom the effect is applied. + * @param index the position index of the effect to apply. + * @throws IndexOutOfBoundsException if {@code index < 0} or {@code index >= 5}. */ @Override protected void effect(Player player,int index) throws IndexOutOfBoundsException @@ -56,7 +56,6 @@ public class Order5 extends OrderLogicCard { if(player.removeFood(1)){ player.removePrestige(2); } - return; } } }