From c2500292f08d5c00a237b67539930b6ee11da6f6 Mon Sep 17 00:00:00 2001 From: MatteoPellegrino05 Date: Sun, 19 Apr 2026 15:29:28 +0200 Subject: [PATCH] Add: Javadoc for Slot class --- .../java/it/polimi/ingsw/gc14/Model/Slot.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java b/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java index 083e9f9..4f41da4 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java @@ -1,26 +1,79 @@ package it.polimi.ingsw.gc14.Model; +/** + * Represents a slot with a specific identifier and associated values + * for upper cards, lower cards, food, and minimum number of players. + * The slot configuration depends on the specified slot identifier. + */ public class Slot { // Getters + + /** + * The identifier of this slot. + */ private char slotId; + + /** + * Returns the identifier of this slot. + * + * @return the identifier of this slot. + */ public char getSlotId() { return slotId; } + + /** + * The number of upper cards associated with this slot. + */ private int NUpper; + /** + * Returns the number of upper cards associated with this slot. + * + * @return the number of upper cards associated with this slot. + */ public int getNUpper(){ return NUpper; } + + /** + * The minimum number of players required for this slot. + */ private int nMinPlayer; + + /** + * Returns the minimum number of players required for this slot. + * + * @return the minimum number of players required for this slot. + */ public int getNMinPlayer() { return nMinPlayer; } + + /** + * The number of lower cards associated with this slot. + */ private int NLower; + + /** + * Returns the number of lower cards associated with this slot. + * + * @return the number of lower cards associated with this slot. + */ public int getNLower(){ return NLower; } + /** + * The amount of Food associated with this slot. + */ private int Food; + + /** + * Returns the amount of Food associated with this slot. + * + * @return the amount of Food associated with this slot. + */ public int getFood(){ return Food; } @@ -28,7 +81,17 @@ public class Slot { // Setters // End setters + // Constructors + + /** + * Creates a slot with the specified identifier. + * The slot values for Food, NLower, NUpper, and minimum number of players + * are determined by the given slot identifier. + * + * @param slotId the identifier of the slot. + * @throws IllegalArgumentException if the specified slot identifier is not valid. + */ public Slot(char slotId) throws IllegalArgumentException { this.slotId = slotId; @@ -78,6 +141,14 @@ public class Slot { } } + + /** + * Returns the string representation of this slot. + * The returned string includes the slot identifier, number of upper cards, + * number of lower cards, food value, and minimum number of players. + * + * @return the string representation of this slot. + */ @Override public String toString() { return ("SlotID: "+this.getSlotId()+"\nNUpper: "+this.getNUpper()+"\nNLower: "+this.getNLower()+"\nFood: "+this.getFood()+"\nNMinPlayer: "+this.getNMinPlayer()+"\n");