Merge pull request #13

Add: PlayerTest.java Added Javadoc For "getNType"
This commit is contained in:
GabrieleRadice
2026-04-11 16:34:30 +02:00
committed by GitHub
@@ -22,7 +22,7 @@ public class Player {
* exceed {@link #MAX_VALUE} otherwise an {@link IllegalArgumentException} will be thrown
* when the {@link #Player(String) constructor} is called.
*/
private String UserName;
private final String UserName;
/**
* Getter for the private attribute {@link #UserName}.
@@ -33,7 +33,7 @@ public class Player {
}
/**
* Returns the total {@link it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character Character Cards}
* Counts the total {@link it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character Character Cards}
* the player currently posses.
* @return int
*/
@@ -42,6 +42,13 @@ public class Player {
.mapToInt(this::getNType)
.sum();
}
/**
* Counts the total number of cards of the specified {@link it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType Character Type}.
* Character Type must not be {@code null}
* @param type the Character Type to be Counted.
* @return int
*/
public int getNType(CharacterType type) {
return switch (type) {
case ARTIST -> artists.size();