From 848bdffecbd7ddfcf5a065a560fbeaa496faa5db Mon Sep 17 00:00:00 2001 From: Alex Ciornei Date: Thu, 24 Nov 2022 18:38:41 +0200 Subject: [PATCH] fix checkstyle errors --- checkstyle.txt | 431 +----------------- src/main/Deck.java | 30 +- src/main/Game.java | 205 ++++++--- src/main/Main.java | 23 +- src/main/Player.java | 2 +- src/main/Statistics.java | 31 +- src/main/card/Card.java | 83 +++- src/main/card/EnvironmentCard.java | 13 +- src/main/card/HeroCard.java | 48 +- src/main/card/MinionCard.java | 80 ++-- src/main/card/ability/BloodThirst.java | 4 +- src/main/card/ability/EarthBorn.java | 4 +- src/main/card/ability/Firestorm.java | 5 +- src/main/card/ability/GodsPlan.java | 4 +- src/main/card/ability/HeartHound.java | 12 +- src/main/card/ability/LowBlow.java | 11 +- src/main/card/ability/RowAbility.java | 10 +- src/main/card/ability/Shapeshift.java | 4 +- src/main/card/ability/Skyjack.java | 4 +- src/main/card/ability/SpecialAbility.java | 6 +- src/main/card/ability/SubZero.java | 11 +- src/main/card/ability/WeakKnees.java | 4 +- src/main/card/ability/Winterfell.java | 4 +- src/main/command/CardUsesAbility.java | 18 +- src/main/command/CardUsesAttack.java | 18 +- src/main/command/Command.java | 6 +- src/main/command/EndPlayerTurn.java | 8 +- src/main/command/GetCardAtPosition.java | 17 +- src/main/command/GetCardsInHand.java | 11 +- src/main/command/GetCardsOnTable.java | 11 +- .../command/GetEnvironmentCardsInHand.java | 14 +- src/main/command/GetFrozenCardsOnTable.java | 8 +- src/main/command/GetPlayerDeck.java | 11 +- src/main/command/GetPlayerHero.java | 10 +- src/main/command/GetPlayerMana.java | 12 +- src/main/command/GetPlayerOneWins.java | 4 +- src/main/command/GetPlayerTurn.java | 8 +- src/main/command/GetPlayerTwoWins.java | 4 +- src/main/command/GetTotalGamesPlayed.java | 4 +- src/main/command/PlaceCard.java | 12 +- src/main/command/UseAttackHero.java | 16 +- src/main/command/UseEnvironmentCard.java | 17 +- src/main/command/UseHeroAbility.java | 12 +- 43 files changed, 510 insertions(+), 740 deletions(-) diff --git a/checkstyle.txt b/checkstyle.txt index d293e20..0f6ad66 100644 --- a/checkstyle.txt +++ b/checkstyle.txt @@ -1,411 +1,24 @@ Starting audit... -[ERROR] /home/student/poo-tema1/./src/main/Main.java:10:8: Unused import - fileio.CardInput. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:13:8: Unused import - main.card.Card. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:14:8: Unused import - main.card.EnvironmentCard. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:16:8: Unused import - main.card.MinionCard. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:18:8: Unused import - main.command.GetPlayerDeck. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:20:8: Unused import - javax.swing.plaf.IconUIResource. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:23:8: Unused import - java.lang.reflect.InvocationTargetException. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:27:17: Using the '.*' form of import should be avoided - java.util.*. [AvoidStarImport] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:28:8: Unused import - java.util.stream.Collectors. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:100:43: ':' should be on a new line. [OperatorWrap] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:109: Line is longer than 100 characters (found 102). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Main.java:111: Line is longer than 100 characters (found 102). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:4:8: Unused import - fileio.DecksInput. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:15:21: Variable 'cards' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:17:17: Parameter deckInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:20:17: switch without "default" clause. [MissingSwitchDefault] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:37:5: Class 'Deck' looks like designed for extension (can be subclassed), but the method 'getCards' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Deck' final or making the method 'getCards' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:41:5: Class 'Deck' looks like designed for extension (can be subclassed), but the method 'setCards' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Deck' final or making the method 'setCards' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Deck.java:41:26: Parameter cards should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:8:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:9:9: Variable 'playerIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:11:26: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:11:37: Parameter playerIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:16:5: Class 'GetPlayerMana' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetPlayerMana' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:17:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerMana.java:18:41: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerDeck.java:7:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerDeck.java:8:9: Variable 'playerIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerDeck.java:10:26: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerDeck.java:10:37: Parameter playerIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerDeck.java:15:5: Class 'GetPlayerDeck' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetPlayerDeck' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerDeck.java:16:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerOneWins.java:7:5: Class 'GetPlayerOneWins' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetPlayerOneWins' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerOneWins.java:8:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:10:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:11:17: Variable 'attacker' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:13:26: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:13:37: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:18:5: Class 'UseAttackHero' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'UseAttackHero' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:19:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:53:53: '+' should be on a new line. [OperatorWrap] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:54:61: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/command/UseAttackHero.java:54:78: '+' should be on a new line. [OperatorWrap] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:10:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:11:9: Variable 'handIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:13:22: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:13:33: Parameter handIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:18:5: Class 'PlaceCard' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'PlaceCard' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:19:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/PlaceCard.java:20:52: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:9:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:10:17: Variable 'attacker' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:11:17: Variable 'defender' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:13:28: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:13:39: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:13:61: Parameter defender should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:19:5: Class 'CardUsesAbility' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'CardUsesAbility' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:20:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAbility.java:46: Line is longer than 100 characters (found 111). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerTwoWins.java:7:5: Class 'GetPlayerTwoWins' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetPlayerTwoWins' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerTwoWins.java:8:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/EndPlayerTurn.java:7:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/EndPlayerTurn.java:9:26: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/EndPlayerTurn.java:13:5: Class 'EndPlayerTurn' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'EndPlayerTurn' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/EndPlayerTurn.java:14:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:5:8: Unused import - main.card.Card. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:9:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:10:9: Variable 'x' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:11:9: Variable 'y' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:13:30: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:13:41: Parameter x should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:13:48: Parameter y should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:19:5: Class 'GetCardAtPosition' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetCardAtPosition' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:20:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardAtPosition.java:25: Line is longer than 100 characters (found 113). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:10:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:11:9: Variable 'handIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:12:9: Variable 'affectedRow' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:14:31: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:14:42: Parameter handIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:14:55: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:20:5: Class 'UseEnvironmentCard' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'UseEnvironmentCard' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:21:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:22:52: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/command/UseEnvironmentCard.java:40: Line is longer than 100 characters (found 101). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerTurn.java:7:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerTurn.java:9:26: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerTurn.java:13:5: Class 'GetPlayerTurn' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetPlayerTurn' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerTurn.java:14:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerHero.java:8:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerHero.java:9:9: Variable 'playerIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerHero.java:11:26: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerHero.java:11:37: Parameter playerIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerHero.java:16:5: Class 'GetPlayerHero' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetPlayerHero' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetPlayerHero.java:17:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:9:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:10:9: Variable 'affectedRow' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:12:27: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:12:38: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:17:5: Class 'UseHeroAbility' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'UseHeroAbility' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:18:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/UseHeroAbility.java:21:52: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:9:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:10:17: Variable 'attacker' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:11:17: Variable 'defender' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:13:27: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:13:38: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:13:60: Parameter defender should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:19:5: Class 'CardUsesAttack' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'CardUsesAttack' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:20:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/CardUsesAttack.java:58:13: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/command/GetTotalGamesPlayed.java:7:5: Class 'GetTotalGamesPlayed' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetTotalGamesPlayed' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetTotalGamesPlayed.java:8:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/Command.java:6:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/command/Command.java:6:5: Redundant 'public' modifier. [RedundantModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:6:8: Unused import - main.card.EnvironmentCard. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:12:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:13:9: Variable 'playerIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:15:27: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:15:38: Parameter playerIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:20:5: Class 'GetCardsInHand' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetCardsInHand' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsInHand.java:21:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsOnTable.java:5:8: Unused import - main.card.Card. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsOnTable.java:7:8: Unused import - java.util.ArrayList. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsOnTable.java:10:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsOnTable.java:12:28: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsOnTable.java:16:5: Class 'GetCardsOnTable' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetCardsOnTable' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetCardsOnTable.java:17:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:8:8: Unused import - java.util.ArrayList. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:10:8: Unused import - java.util.stream.Collectors. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:13:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:14:9: Variable 'playerIdx' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:16:38: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:16:49: Parameter playerIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:21:5: Class 'GetEnvironmentCardsInHand' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetEnvironmentCardsInHand' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:22:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetEnvironmentCardsInHand.java:23:52: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/command/GetFrozenCardsOnTable.java:10:10: Variable 'game' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/command/GetFrozenCardsOnTable.java:12:34: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/command/GetFrozenCardsOnTable.java:16:5: Class 'GetFrozenCardsOnTable' looks like designed for extension (can be subclassed), but the method 'execute' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GetFrozenCardsOnTable' final or making the method 'execute' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/command/GetFrozenCardsOnTable.java:17:25: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:3:1: Class Statistics should be declared as final. [FinalClass] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:4:37: Name 'instance' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'. [ConstantName] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:5:9: Variable 'gamesPlayed' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:6:9: Variable 'player1Wins' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:7:9: Variable 'player2Wins' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:9:26: '{' is not followed by whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:9:27: '}' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:27:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:27:24: Parameter player should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:29:9: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:31:9: 'else' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/Statistics.java:37:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:7:8: Unused import - main.card.HeroCard. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:9:20: Using the '.*' form of import should be avoided - main.command.*. [AvoidStarImport] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:11:17: Using the '.*' form of import should be avoided - java.util.*. [AvoidStarImport] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:12:8: Unused import - java.util.stream.Collectors. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:45:12: Variable 'player1' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:46:12: Variable 'player2' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:47:9: Variable 'player1DeckId' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:48:9: Variable 'player2DeckId' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:49:9: Variable 'turn' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:50:9: Variable 'round' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:51:9: Variable 'playerTurn' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:52:38: Variable 'table' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:53:21: Variable 'haveAttacked' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:55:17: Parameter player1 should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:55:33: Parameter player2 should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:55:49: Parameter startGameInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:68: Line is longer than 100 characters (found 102). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:69: Line is longer than 100 characters (found 102). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:84:33: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:103:31: Parameter playerTurn should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:111:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:111:33: Parameter card should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:115:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:119:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:122:20: '3' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:129:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:130:9: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:134:39: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:141:41: '10' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:149:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:149:30: Parameter row should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:150:41: '5' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:153:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:153:38: Parameter row should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:154:9: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:154:52: '3' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:156:9: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:161:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:161:29: Parameter row should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:162:9: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:163:30: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:163:32: '3' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:164:24: '3' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:164:26: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:167:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:167:34: Parameter card should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:167:51: Parameter row should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:175:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:175:41: Parameter row should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:179:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:179:41: Parameter x should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:179:48: Parameter y should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:187:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:196:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:196:32: Parameter row should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:204:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:215:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:215:37: Parameter actionsInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:223: Line is longer than 100 characters (found 109). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:225: Line is longer than 100 characters (found 110). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:233: Line is longer than 100 characters (found 107). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:234: Line is longer than 100 characters (found 113). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:235: Line is longer than 100 characters (found 110). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:241:37: Parameter output should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Game.java:242: Line is longer than 100 characters (found 103). [LineLength] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:9:9: Variable 'mana' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:10:12: Variable 'description' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:11:14: Variable 'colors' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:12:12: Variable 'name' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:14:17: Parameter mana should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:14:27: Parameter description should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:14:47: Parameter colors should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:14:64: Parameter name should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:21:17: Parameter cardInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:28:19: '{' is not followed by whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:28:20: '}' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:30:17: Parameter card should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:37:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'getMana' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'getMana' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:41:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'setMana' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'setMana' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:41:25: Parameter mana should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:45:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'getDescription' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'getDescription' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:49:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'setDescription' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'setDescription' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:49:32: Parameter description should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:53:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'getColors' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'getColors' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:57:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'setColors' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'setColors' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:57:27: Parameter colors should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:61:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'getName' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'getName' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:65:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'setName' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'setName' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:65:25: Parameter name should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:69:5: Class 'Card' looks like designed for extension (can be subclassed), but the method 'canBePlacedOnTable' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Card' final or making the method 'canBePlacedOnTable' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:69:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:73:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:73:34: Parameter card should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:73:45: Parameter playerIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:75:36: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:76:11: 'else' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:77:36: '?' is not preceded with whitespace. [WhitespaceAround] -[ERROR] /home/student/poo-tema1/./src/main/card/Card.java:77:38: '3' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:3:8: Unused import - com.fasterxml.jackson.annotation.JsonIgnoreProperties. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:6:25: Using the '.*' form of import should be avoided - main.card.ability.*. [AvoidStarImport] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:10:9: Variable 'health' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:11:9: Variable 'attackDamage' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:12:13: Variable 'frozen' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:13:20: Variable 'specialAbility' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:15:23: Parameter cardInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:21:49: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:22:44: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:23:53: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:24:47: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:30:23: Parameter card should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:36:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'setSpecialAbility' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'setSpecialAbility' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:36:35: Parameter specialAbility should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:40:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'getHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'getHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:44:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'setHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'setHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:44:27: Parameter health should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:48:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'addHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'addHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:48:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:48:27: Parameter health should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:48:31: 'health' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:51:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'getAttackDamage' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'getAttackDamage' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:55:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'setAttackDamage' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'setAttackDamage' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:55:33: Parameter attackDamage should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:59:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'addAttackDamage' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'addAttackDamage' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:59:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:59:33: Parameter attackDamage should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:59:37: 'attackDamage' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:63:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'removeAttackDamage' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'removeAttackDamage' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:63:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:63:36: Parameter attackDamage should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:63:40: 'attackDamage' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:65:9: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:69:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'isFrozen' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'isFrozen' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:73:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'setFrozen' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'setFrozen' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:73:27: Parameter frozen should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:77:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'removeHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'removeHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:77:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:77:30: Parameter health should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:77:34: 'health' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:81:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'useSpecialAbility' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'useSpecialAbility' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:81:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:81:35: Parameter target should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:85:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'attackCard' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'attackCard' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:85:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:85:28: Parameter card should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:89:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'attackHero' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'attackHero' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:89:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:89:28: Parameter heroCard should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/MinionCard.java:92:5: Class 'MinionCard' looks like designed for extension (can be subclassed), but the method 'canBePlacedOnTable' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'MinionCard' final or making the method 'canBePlacedOnTable' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SpecialAbility.java:6:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SpecialAbility.java:6:5: Redundant 'public' modifier. [RedundantModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/HeartHound.java:10:5: Class 'HeartHound' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'HeartHound' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/HeartHound.java:11:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/HeartHound.java:11:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/HeartHound.java:15:32: Parameter o1 should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/HeartHound.java:15:47: Parameter o2 should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SubZero.java:9:5: Class 'SubZero' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'SubZero' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SubZero.java:10:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SubZero.java:10:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SubZero.java:14:30: ':' should be on a new line. [OperatorWrap] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/SubZero.java:16:13: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Shapeshift.java:6:5: Class 'Shapeshift' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Shapeshift' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Shapeshift.java:7:21: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Shapeshift.java:7:42: Parameter target should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Winterfell.java:9:5: Class 'Winterfell' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Winterfell' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Winterfell.java:10:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Winterfell.java:10:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/EarthBorn.java:9:5: Class 'EarthBorn' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'EarthBorn' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/EarthBorn.java:10:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/EarthBorn.java:10:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Firestorm.java:4:8: Unused import - main.card.Card. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Firestorm.java:10:5: Class 'Firestorm' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Firestorm' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Firestorm.java:11:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Firestorm.java:11:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/RowAbility.java:1: File does not end with a newline. [NewlineAtEndOfFile] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/RowAbility.java:4:8: Unused import - main.card.Card. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/RowAbility.java:5:8: Unused import - main.card.MinionCard. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/RowAbility.java:7:8: Unused import - java.util.ArrayList. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/RowAbility.java:10:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Skyjack.java:6:5: Class 'Skyjack' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Skyjack' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Skyjack.java:7:21: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/Skyjack.java:7:42: Parameter target should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/LowBlow.java:9:5: Class 'LowBlow' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'LowBlow' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/LowBlow.java:10:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/LowBlow.java:10:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/LowBlow.java:14:30: ':' should be on a new line. [OperatorWrap] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/LowBlow.java:16:13: 'if' construct must use '{}'s. [NeedBraces] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/LowBlow.java:16:16: '(' is followed by whitespace. [ParenPad] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/BloodThirst.java:9:5: Class 'BloodThirst' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'BloodThirst' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/BloodThirst.java:10:21: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/BloodThirst.java:10:32: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/GodsPlan.java:6:5: Class 'GodsPlan' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'GodsPlan' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/GodsPlan.java:7:21: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/GodsPlan.java:7:42: Parameter target should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/WeakKnees.java:6:5: Class 'WeakKnees' looks like designed for extension (can be subclassed), but the method 'use' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'WeakKnees' final or making the method 'use' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/WeakKnees.java:7:21: Parameter attacker should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/ability/WeakKnees.java:7:42: Parameter target should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:8:16: Variable 'rowAbility' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:9:28: Parameter cardInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:9:49: Parameter rowAbility should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:14:5: Class 'EnvironmentCard' looks like designed for extension (can be subclassed), but the method 'useRowAbility' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'EnvironmentCard' final or making the method 'useRowAbility' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:14:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:14:31: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/EnvironmentCard.java:14:42: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:5:25: Using the '.*' form of import should be avoided - main.card.ability.*. [AvoidStarImport] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:7:8: Unused import - java.security.PublicKey. [UnusedImports] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:10:9: Variable 'health' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:10:18: '30' is a magic number. [MagicNumber] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:11:16: Variable 'rowAbility' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:13:21: Parameter mana should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:13:31: Parameter description should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:13:51: Parameter colors should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:13:68: Parameter name should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:17:21: Parameter cardInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:20:9: switch without "default" clause. [MissingSwitchDefault] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:21:45: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:22:50: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:23:47: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:24:51: Inner assignments should be avoided. [InnerAssignment] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:28:21: Parameter heroCard should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:32:5: Class 'HeroCard' looks like designed for extension (can be subclassed), but the method 'getHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'HeroCard' final or making the method 'getHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:36:5: Class 'HeroCard' looks like designed for extension (can be subclassed), but the method 'setHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'HeroCard' final or making the method 'setHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:36:27: Parameter health should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:40:5: Class 'HeroCard' looks like designed for extension (can be subclassed), but the method 'removeHealth' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'HeroCard' final or making the method 'removeHealth' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:40:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:40:30: Parameter health should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:40:34: 'health' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:44:5: Class 'HeroCard' looks like designed for extension (can be subclassed), but the method 'useHeroAbility' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'HeroCard' final or making the method 'useHeroAbility' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:44:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:44:32: Parameter game should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/card/HeroCard.java:44:43: Parameter affectedRow should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:10:21: Variable 'decks' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:11:21: Variable 'hand' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:12:14: Variable 'heroCard' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:13:9: Variable 'mana' must be private and have accessor methods. [VisibilityModifier] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:15:19: Parameter decksInput should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:19:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'getDecks' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'getDecks' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:23:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'setDecks' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'setDecks' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:23:26: Parameter decks should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:27:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'getMana' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'getMana' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:31:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'addMana' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'addMana' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:31:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:31:25: Parameter mana should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:31:29: 'mana' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:35:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'removeMana' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'removeMana' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:35:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:35:28: Parameter mana should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:35:32: 'mana' hides a field. [HiddenField] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:39:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'getHeroCard' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'getHeroCard' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:43:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'setHeroCard' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'setHeroCard' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:43:29: Parameter heroCard should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:47:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'getHand' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'getHand' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:51:5: Class 'Player' looks like designed for extension (can be subclassed), but the method 'addCardToHand' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'Player' final or making the method 'addCardToHand' static/final/abstract/empty, or adding allowed annotation for the method. [DesignForExtension] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:51:5: Missing a Javadoc comment. [MissingJavadocMethod] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:51:31: Parameter deckIdx should be final. [FinalParameters] -[ERROR] /home/student/poo-tema1/./src/main/Player.java:52:9: 'if' construct must use '{}'s. [NeedBraces] +[ERROR] /home/student/oop-tema1/./src/main/Game.java:9:20: Using the '.*' form of import should be avoided - main.command.*. [AvoidStarImport] +[ERROR] /home/student/oop-tema1/./src/main/Game.java:11:17: Using the '.*' form of import should be avoided - java.util.*. [AvoidStarImport] +[ERROR] /home/student/oop-tema1/./src/main/card/MinionCard.java:5:25: Using the '.*' form of import should be avoided - main.card.ability.*. [AvoidStarImport] +[ERROR] /home/student/oop-tema1/./src/main/card/HeroCard.java:5:25: Using the '.*' form of import should be avoided - main.card.ability.*. [AvoidStarImport] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:10:21: Variable 'decks' must be private and have accessor methods. [VisibilityModifier] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:11:21: Variable 'hand' must be private and have accessor methods. [VisibilityModifier] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:12:14: Variable 'heroCard' must be private and have accessor methods. [VisibilityModifier] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:13:9: Variable 'mana' must be private and have accessor methods. [VisibilityModifier] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:15:19: Parameter decksInput should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:23:26: Parameter decks should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:31:25: Parameter mana should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:35:5: Missing a Javadoc comment. [MissingJavadocMethod] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:35:25: Parameter mana should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:35:29: 'mana' hides a field. [HiddenField] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:39:5: Missing a Javadoc comment. [MissingJavadocMethod] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:39:28: Parameter mana should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:39:32: 'mana' hides a field. [HiddenField] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:47:29: Parameter heroCard should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:55:5: Missing a Javadoc comment. [MissingJavadocMethod] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:55:31: Parameter deckIdx should be final. [FinalParameters] +[ERROR] /home/student/oop-tema1/./src/main/Player.java:56:9: 'if' construct must use '{}'s. [NeedBraces] Audit done. -Checkstyle ends with 408 errors. +Checkstyle ends with 21 errors. diff --git a/src/main/Deck.java b/src/main/Deck.java index 715dfbb..9928579 100644 --- a/src/main/Deck.java +++ b/src/main/Deck.java @@ -1,7 +1,6 @@ package main; import fileio.CardInput; -import fileio.DecksInput; import main.card.Card; import main.card.EnvironmentCard; import main.card.MinionCard; @@ -11,22 +10,23 @@ import java.util.ArrayList; -public class Deck { - ArrayList cards = new ArrayList<>(); +public final class Deck { + private final ArrayList cards = new ArrayList<>(); - public Deck(ArrayList deckInput) { + public Deck(final ArrayList deckInput) { deckInput.forEach(cardInput -> { if (Game.ENVIRONMENT_CARDS.contains(cardInput.getName())) { switch (cardInput.getName()) { - case "Firestorm": - cards.add(new EnvironmentCard(cardInput, new Firestorm())); - break; - case "Winterfell": - cards.add(new EnvironmentCard(cardInput, new Winterfell())); - break; - case "Heart Hound": - cards.add(new EnvironmentCard(cardInput, new HeartHound())); - break; + case "Firestorm" -> cards.add( + new EnvironmentCard(cardInput, new Firestorm()) + ); + case "Winterfell" -> cards.add( + new EnvironmentCard(cardInput, new Winterfell()) + ); + case "Heart Hound" -> cards.add( + new EnvironmentCard(cardInput, new HeartHound()) + ); + default -> { } } } else { cards.add(new MinionCard(cardInput)); @@ -37,8 +37,4 @@ public Deck(ArrayList deckInput) { public ArrayList getCards() { return cards; } - - public void setCards(ArrayList cards) { - this.cards = cards; - } } diff --git a/src/main/Game.java b/src/main/Game.java index e6b42be..5316f56 100644 --- a/src/main/Game.java +++ b/src/main/Game.java @@ -4,14 +4,17 @@ import fileio.ActionsInput; import fileio.StartGameInput; import main.card.Card; -import main.card.HeroCard; + import main.card.MinionCard; import main.command.*; import java.util.*; -import java.util.stream.Collectors; public final class Game { + public static final int MAX_MANA_ADDED_PER_TURN = 10; + public static final int MAX_CARDS_PER_ROW = 5; + public static final int PLAYER_ONE_BACK_ROW = 3; + public static final List ENVIRONMENT_CARDS = Collections.unmodifiableList( Arrays.asList( "Winterfell", @@ -42,18 +45,19 @@ public final class Game { ) ); - Player player1; - Player player2; - int player1DeckId; - int player2DeckId; - int turn = 1; - int round = 1; - int playerTurn; - ArrayList> table = new ArrayList>(); - ArrayList haveAttacked = new ArrayList<>(); - - public Game(Player player1, Player player2, StartGameInput startGameInput) { - + private final Player player1; + private final Player player2; + private final int player1DeckId; + private final int player2DeckId; + private int turn = 1; + private int round = 1; + private int playerTurn; + private final ArrayList> table = new ArrayList>(); + private final ArrayList haveAttacked = new ArrayList<>(); + + public Game(final Player player1, + final Player player2, + final StartGameInput startGameInput) { this.player1 = player1; this.player2 = player2; player1DeckId = startGameInput.getPlayerOneDeckIdx(); @@ -65,8 +69,14 @@ public Game(Player player1, Player player2, StartGameInput startGameInput) { table.add(new ArrayList()); table.add(new ArrayList()); - Collections.shuffle(getPlayer1Deck().getCards(), new Random(startGameInput.getShuffleSeed())); - Collections.shuffle(getPlayer2Deck().getCards(), new Random(startGameInput.getShuffleSeed())); + Collections.shuffle( + getPlayer1Deck().getCards(), + new Random(startGameInput.getShuffleSeed()) + ); + Collections.shuffle( + getPlayer2Deck().getCards(), + new Random(startGameInput.getShuffleSeed()) + ); player1.addCardToHand(player1DeckId); player2.addCardToHand(player2DeckId); @@ -81,7 +91,7 @@ public Player getPlayer2() { } public Player getEnemyPlayer() { - return (playerTurn == 1)? player2 : player1; + return (playerTurn == 1) ? player2 : player1; } public Deck getPlayer1Deck() { @@ -100,45 +110,56 @@ public int getPlayerTurn() { return playerTurn; } - public void setPlayerTurn(int playerTurn) { - this.playerTurn = playerTurn; - } - public ArrayList getHaveAttacked() { return haveAttacked; } - public void cardHasAttacked(Card card) { + /** + * @param card Card which has attacked + */ + public void cardHasAttacked(final Card card) { this.haveAttacked.add(card); } + /** + * clear the lists of cards that have attacked this turn + */ public void resetHaveAttacked() { this.haveAttacked.clear(); } + /** + * unfreezes cards at the end of a turn + */ public void unfreezeCards() { if (playerTurn == 1) { getRow(2).forEach(card -> card.setFrozen(false)); - getRow(3).forEach(card -> card.setFrozen(false)); + getRow(PLAYER_ONE_BACK_ROW).forEach(card -> card.setFrozen(false)); } else { getRow(0).forEach(card -> card.setFrozen(false)); getRow(1).forEach(card -> card.setFrozen(false)); } } + /** + * unfreezes cards, + * changes the current player, + * adds mana to each player if the round has ended + */ public void endCurrentTurn() { - if (++turn > 2) + if (++turn > 2) { nextRound(); + } unfreezeCards(); - playerTurn = (playerTurn == 1)? 2 : 1; + playerTurn = (playerTurn == 1) ? 2 : 1; } private void nextRound() { round++; turn = 1; - int extraMana = Math.min(round, 10); + int extraMana = Math.min(round, MAX_MANA_ADDED_PER_TURN); player1.addMana(extraMana); player2.addMana(extraMana); @@ -146,37 +167,68 @@ private void nextRound() { player2.addCardToHand(player2DeckId); } - public boolean isRowFull(int row) { - return table.get(row).size() == 5; + /** + * @param row a row on the table [0-3] + * @return true if the row is full, false if not + */ + public boolean isRowFull(final int row) { + return table.get(row).size() == MAX_CARDS_PER_ROW; } - public boolean rowBelongsToEnemy(int row) { - if (playerTurn == 1 && (row == 2 || row == 3)) + /** + * @param row a row on the table [0-3] + * @return true if the row belongs to the enemy, false if not + */ + public boolean rowBelongsToEnemy(final int row) { + if (playerTurn == 1 && (row == 2 || row == PLAYER_ONE_BACK_ROW)) { return false; - if (playerTurn == 2 && (row == 0 || row == 1)) + } + if (playerTurn == 2 && (row == 0 || row == 1)) { return false; + } return true; } - public int getMirrorRow(int row) { - if (playerTurn == 1) - return (row == 0)? 3 : 2; - return (row == 3)? 0 : 1; + /** + * @param row a row on the table [0-3] + * @return the opposite row, belonging to the enemy + */ + public int getMirrorRow(final int row) { + if (playerTurn == 1) { + return (row == 0) ? PLAYER_ONE_BACK_ROW : 2; + } + return (row == PLAYER_ONE_BACK_ROW) ? 0 : 1; } - public void placeCardOnTable(MinionCard card, int row) { + /** + * @param card card to be placed on the table + * @param row the row on which it should be placed + */ + public void placeCardOnTable(final MinionCard card, final int row) { table.get(row).add(card); } + /** + * @return ArrayList of the rows on the table + */ public ArrayList> getCardsOnTable() { return table; } - public ArrayList getRow(int row) { + /** + * @param row a row on the table [0-3] + * @return ArrayList of cards in a row + */ + public ArrayList getRow(final int row) { return table.get(row); } - public MinionCard getCardAtPosition(int x, int y) { + /** + * @param x x position on table + * @param y y position on table + * @return the Card found at the specified position on the table + */ + public MinionCard getCardAtPosition(final int x, final int y) { try { return table.get(x).get(y); } catch (IndexOutOfBoundsException e) { @@ -184,6 +236,9 @@ public MinionCard getCardAtPosition(int x, int y) { } } + /** + * removes the cards with <= 0 health from the table + */ public void removeDeadCards() { table.forEach(minionCards -> { List deadCards = minionCards.stream() @@ -193,7 +248,11 @@ public void removeDeadCards() { }); } - public boolean rowHasTanks(int row) { + /** + * @param row a row on the table [0-3] + * @return true if the row has tank cards + */ + public boolean rowHasTanks(final int row) { List tanks = getRow(row).stream() .filter(card -> TANK_CARDS.contains(card.getName())) .toList(); @@ -201,6 +260,9 @@ public boolean rowHasTanks(int row) { return tanks.size() != 0; } + /** + * @return true if the enemy has tank cards + */ public boolean enemyHasTanks() { if (playerTurn == 1) { return rowHasTanks(1); @@ -208,24 +270,31 @@ public boolean enemyHasTanks() { return rowHasTanks(2); } + /** + * @return true if the game is over (a hero is dead) + */ public boolean isGameOver() { return player1.getHeroCard().getHealth() <= 0 || player2.getHeroCard().getHealth() <= 0; } - public void resetCards() { - player1.getHand().forEach(card -> getPlayer1Deck().getCards().add(card)); - player2.getHand().forEach(card -> getPlayer2Deck().getCards().add(card)); - - table.get(3).forEach(card -> getPlayer1Deck().getCards().add(card)); - table.get(2).forEach(card -> getPlayer1Deck().getCards().add(card)); - table.get(1).forEach(card -> getPlayer2Deck().getCards().add(card)); - table.get(0).forEach(card -> getPlayer2Deck().getCards().add(card)); - - player1.getHand().clear(); - player2.getHand().clear(); - } - - public Command getCommandObject(ActionsInput actionsInput) { +// public void resetCards() { +// player1.getHand().forEach(card -> getPlayer1Deck().getCards().add(card)); +// player2.getHand().forEach(card -> getPlayer2Deck().getCards().add(card)); +// +// table.get(3).forEach(card -> getPlayer1Deck().getCards().add(card)); +// table.get(2).forEach(card -> getPlayer1Deck().getCards().add(card)); +// table.get(1).forEach(card -> getPlayer2Deck().getCards().add(card)); +// table.get(0).forEach(card -> getPlayer2Deck().getCards().add(card)); +// +// player1.getHand().clear(); +// player2.getHand().clear(); +// } + + /** + * @param actionsInput action input object from fileio + * @return the command object to be executed + */ + public Command getCommandObject(final ActionsInput actionsInput) { return switch (actionsInput.getCommand()) { case "getPlayerDeck" -> new GetPlayerDeck(this, actionsInput.getPlayerIdx()); case "getPlayerHero" -> new GetPlayerHero(this, actionsInput.getPlayerIdx()); @@ -233,9 +302,15 @@ public Command getCommandObject(ActionsInput actionsInput) { case "endPlayerTurn" -> new EndPlayerTurn(this); case "placeCard" -> new PlaceCard(this, actionsInput.getHandIdx()); case "cardUsesAttack" -> - new CardUsesAttack(this, actionsInput.getCardAttacker(), actionsInput.getCardAttacked()); + new CardUsesAttack( + this, + actionsInput.getCardAttacker(), + actionsInput.getCardAttacked()); case "cardUsesAbility" -> - new CardUsesAbility(this, actionsInput.getCardAttacker(), actionsInput.getCardAttacked()); + new CardUsesAbility( + this, + actionsInput.getCardAttacker(), + actionsInput.getCardAttacked()); case "useAttackHero" -> new UseAttackHero(this, actionsInput.getCardAttacker()); case "useHeroAbility" -> new UseHeroAbility(this, actionsInput.getAffectedRow()); case "getPlayerMana" -> new GetPlayerMana(this, actionsInput.getPlayerIdx()); @@ -243,16 +318,26 @@ public Command getCommandObject(ActionsInput actionsInput) { case "getCardsOnTable" -> new GetCardsOnTable(this); case "getFrozenCardsOnTable" -> new GetFrozenCardsOnTable(this); case "useEnvironmentCard" -> - new UseEnvironmentCard(this, actionsInput.getHandIdx(), actionsInput.getAffectedRow()); - case "getEnvironmentCardsInHand" -> new GetEnvironmentCardsInHand(this, actionsInput.getPlayerIdx()); - case "getCardAtPosition" -> new GetCardAtPosition(this, actionsInput.getX(), actionsInput.getY()); + new UseEnvironmentCard( + this, + actionsInput.getHandIdx(), + actionsInput.getAffectedRow()); + case "getEnvironmentCardsInHand" -> new GetEnvironmentCardsInHand( + this, + actionsInput.getPlayerIdx()); + case "getCardAtPosition" -> new GetCardAtPosition( + this, + actionsInput.getX(), + actionsInput.getY()); case "getTotalGamesPlayed" -> new GetTotalGamesPlayed(); case "getPlayerOneWins" -> new GetPlayerOneWins(); case "getPlayerTwoWins" -> new GetPlayerTwoWins(); default -> new Command() { @Override - public void execute(ArrayNode output) { - output.addObject().put("error", "Command not found: " + actionsInput.getCommand()); + public void execute(final ArrayNode output) { + output.addObject().put( + "error", + "Command not found: " + actionsInput.getCommand()); } }; }; diff --git a/src/main/Main.java b/src/main/Main.java index 4ecac0c..2fee905 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -7,25 +7,17 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import checker.CheckerConstants; import fileio.ActionsInput; -import fileio.CardInput; import fileio.Input; import fileio.StartGameInput; -import main.card.Card; -import main.card.EnvironmentCard; import main.card.HeroCard; -import main.card.MinionCard; import main.command.Command; -import main.command.GetPlayerDeck; -import javax.swing.plaf.IconUIResource; import java.io.File; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.*; -import java.util.stream.Collectors; +import java.util.Objects; /** * The entry point to this homework. It runs the checker that tests your implentation. @@ -97,20 +89,11 @@ public static void action(final String filePath1, startGameInput ); - for (ActionsInput actionsInput: - gameInput.getActions()) { + for (ActionsInput actionsInput + : gameInput.getActions()) { Command commandObject = game.getCommandObject(actionsInput); -// System.out.println(actionsInput.getCommand()); -// System.out.println(game.rowHasTanks(1)); -// System.out.println(game.rowHasTanks(2)); - commandObject.execute(output); game.removeDeadCards(); -// game.getPlayer1().getHand().forEach(card -> System.out.print(card.getName() + " ")); -// System.out.println(); -// game.getPlayer2().getHand().forEach(card -> System.out.print(card.getName() + " ")); -// System.out.println(); -// System.out.println(); } Statistics.getInstance().reset(); diff --git a/src/main/Player.java b/src/main/Player.java index c11839f..8d398ff 100644 --- a/src/main/Player.java +++ b/src/main/Player.java @@ -6,7 +6,7 @@ import java.util.ArrayList; -public class Player { +public final class Player { ArrayList decks = new ArrayList<>(); ArrayList hand = new ArrayList<>(); HeroCard heroCard; diff --git a/src/main/Statistics.java b/src/main/Statistics.java index e5b574e..e805732 100644 --- a/src/main/Statistics.java +++ b/src/main/Statistics.java @@ -1,15 +1,19 @@ package main; -public class Statistics { - private static final Statistics instance = new Statistics(); - int gamesPlayed = 0; - int player1Wins = 0; - int player2Wins = 0; +public final class Statistics { + /** + * Singleton class for the statistics of the played games + */ - private Statistics() {} + private static final Statistics INSTANCE = new Statistics(); + private int gamesPlayed = 0; + private int player1Wins = 0; + private int player2Wins = 0; + + private Statistics() { } public static Statistics getInstance() { - return instance; + return INSTANCE; } public int getGamesPlayed() { @@ -24,15 +28,22 @@ public int getPlayer2Wins() { return player2Wins; } - public void addWin(int player) { - if (player == 1) + /** + * @param player player who won + */ + public void addWin(final int player) { + if (player == 1) { player1Wins += 1; - else + } else { player2Wins += 1; + } gamesPlayed += 1; } + /** + * resets statistics + */ public void reset() { gamesPlayed = 0; player1Wins = 0; diff --git a/src/main/card/Card.java b/src/main/card/Card.java index 88d7435..35f4999 100644 --- a/src/main/card/Card.java +++ b/src/main/card/Card.java @@ -6,82 +6,121 @@ @JsonIgnoreProperties({"frozen"}) public class Card { - int mana; - String description; - String[] colors; - String name; - - public Card(int mana, String description, String[] colors, String name) { + private int mana; + private String description; + private String[] colors; + protected String name; + + public Card(final int mana, + final String description, + final String[] colors, + final String name) { this.mana = mana; this.description = description; this.colors = colors; this.name = name; } - public Card(CardInput cardInput) { + public Card(final CardInput cardInput) { this.mana = cardInput.getMana(); this.description = cardInput.getDescription(); this.colors = cardInput.getColors().toArray(new String[0]); this.name = cardInput.getName(); } - public Card() {} + public Card() { } - public Card(Card card) { - mana = card.mana; + public Card(final Card card) { + mana = card.getMana(); description = card.getDescription(); colors = card.getColors(); name = card.getName(); } + /** + * @return card's mana point + */ public int getMana() { return mana; } - public void setMana(int mana) { + /** + * @param mana the mana value to be set + */ + public void setMana(final int mana) { this.mana = mana; } + /** + * @return card's description + */ public String getDescription() { return description; } - public void setDescription(String description) { + /** + * @param description the description of the card + */ + public void setDescription(final String description) { this.description = description; } + /** + * @return card's array of colors + */ public String[] getColors() { return colors; } - public void setColors(String[] colors) { + /** + * @param colors array of colors + */ + public void setColors(final String[] colors) { this.colors = colors; } + /** + * @return card's name + */ public String getName() { return name; } - public void setName(String name) { + /** + * @param name a card name + */ + public void setName(final String name) { this.name = name; } + /** + * @return true if card is a minion, false if not + */ public boolean canBePlacedOnTable() { return false; } - public static int getCardRow(Card card, int playerIdx) { + /** + * @param card a card that can be placed on the table + * @param playerIdx payer index (1 or 2) + * @return the row on which the card should be placed + */ + public static int getCardRow(final Card card, final int playerIdx) { if (Game.FRONT_ROW_CARDS.contains(card.getName())) { - return (playerIdx == 1)? 2 : 1; - } else - return (playerIdx == 1)? 3 : 0; + return (playerIdx == 1) ? 2 : 1; + } else { + return (playerIdx == 1) ? Game.PLAYER_ONE_BACK_ROW : 0; + } } + /** + * @return String containing the card's name, mana and description + */ @Override public String toString() { - return "Card{" + - name + "," + - mana + "," + - description; + return "Card{" + + name + "," + + mana + "," + + description; } } diff --git a/src/main/card/EnvironmentCard.java b/src/main/card/EnvironmentCard.java index a53e76d..0db95f5 100644 --- a/src/main/card/EnvironmentCard.java +++ b/src/main/card/EnvironmentCard.java @@ -4,14 +4,19 @@ import main.Game; import main.card.ability.RowAbility; -public class EnvironmentCard extends Card { - RowAbility rowAbility; - public EnvironmentCard(CardInput cardInput, RowAbility rowAbility) { +public final class EnvironmentCard extends Card { + private final RowAbility rowAbility; + public EnvironmentCard(final CardInput cardInput, + final RowAbility rowAbility) { super(cardInput); this.rowAbility = rowAbility; } - public void useRowAbility(Game game, int affectedRow) { + /** + * @param game instance of Game + * @param affectedRow the row on which the ability is used + */ + public void useRowAbility(final Game game, final int affectedRow) { rowAbility.use(game, affectedRow); } } diff --git a/src/main/card/HeroCard.java b/src/main/card/HeroCard.java index be79374..808ba13 100644 --- a/src/main/card/HeroCard.java +++ b/src/main/card/HeroCard.java @@ -4,28 +4,31 @@ import main.Game; import main.card.ability.*; -import java.security.PublicKey; - -public class HeroCard extends Card { - int health = 30; - RowAbility rowAbility; - - public HeroCard(int mana, String description, String[] colors, String name) { +public final class HeroCard extends Card { + public static final int DEFAULT_HEALTH = 30; + private int health = DEFAULT_HEALTH; + private RowAbility rowAbility; + + public HeroCard(final int mana, + final String description, + final String[] colors, + final String name) { super(mana, description, colors, name); } - public HeroCard(CardInput cardInput) { + public HeroCard(final CardInput cardInput) { super(cardInput); switch (name) { - case "Lord Royce" -> rowAbility = new SubZero(); - case "Empress Thorina" -> rowAbility = new LowBlow(); - case "King Mudface" -> rowAbility = new EarthBorn(); - case "General Kocioraw" -> rowAbility = new BloodThirst(); + case "Lord Royce" -> setRowAbility(new SubZero()); + case "Empress Thorina" -> setRowAbility(new LowBlow()); + case "King Mudface" -> setRowAbility(new EarthBorn()); + case "General Kocioraw" -> setRowAbility(new BloodThirst()); + default -> { } } } - public HeroCard(HeroCard heroCard) { + public HeroCard(final HeroCard heroCard) { super(heroCard); this.health = heroCard.getHealth(); } @@ -33,15 +36,26 @@ public int getHealth() { return health; } - public void setHealth(int health) { + public void setHealth(final int health) { this.health = health; } - public void removeHealth(int health) { - this.health -= health; + public void setRowAbility(final RowAbility rowAbility) { + this.rowAbility = rowAbility; + } + + /** + * @param removedHealth points to be removed from card's health + */ + public void removeHealth(final int removedHealth) { + this.health -= removedHealth; } - public void useHeroAbility(Game game, int affectedRow) { + /** + * @param game instance of Game + * @param affectedRow the row on which the ability is used + */ + public void useHeroAbility(final Game game, final int affectedRow) { rowAbility.use(game, affectedRow); } } diff --git a/src/main/card/MinionCard.java b/src/main/card/MinionCard.java index 48f5908..ec3c53f 100644 --- a/src/main/card/MinionCard.java +++ b/src/main/card/MinionCard.java @@ -1,39 +1,37 @@ package main.card; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import fileio.CardInput; import main.card.ability.*; @JsonPropertyOrder({"mana", "attackDamage", "health", "description", "colors", "name"}) -public class MinionCard extends Card { - int health; - int attackDamage; - boolean frozen = false; - SpecialAbility specialAbility; +public final class MinionCard extends Card { + private int health; + private int attackDamage; + private boolean frozen = false; + private SpecialAbility specialAbility; - public MinionCard(CardInput cardInput) { + public MinionCard(final CardInput cardInput) { super(cardInput); this.health = cardInput.getHealth(); this.attackDamage = cardInput.getAttackDamage(); switch (name) { - case "The Ripper" -> specialAbility = new WeakKnees(); - case "Miraj" -> specialAbility = new Skyjack(); - case "The Cursed One" -> specialAbility = new Shapeshift(); - case "Disciple" -> specialAbility = new GodsPlan(); - default -> { - } + case "The Ripper" -> setSpecialAbility(new WeakKnees()); + case "Miraj" -> setSpecialAbility(new Skyjack()); + case "The Cursed One" -> setSpecialAbility(new Shapeshift()); + case "Disciple" -> setSpecialAbility(new GodsPlan()); + default -> { } } } - public MinionCard(MinionCard card) { + public MinionCard(final MinionCard card) { super(card); health = card.health; attackDamage = card.attackDamage; } - public void setSpecialAbility(SpecialAbility specialAbility) { + public void setSpecialAbility(final SpecialAbility specialAbility) { this.specialAbility = specialAbility; } @@ -41,52 +39,74 @@ public int getHealth() { return health; } - public void setHealth(int health) { + public void setHealth(final int health) { this.health = health; } - public void addHealth(int health) { - this.health += health; + /** + * @param health health to be added to the card + */ + public void addHealth(final int addedHealth) { + this.health += addedHealth; } public int getAttackDamage() { return attackDamage; } - public void setAttackDamage(int attackDamage) { + public void setAttackDamage(final int attackDamage) { this.attackDamage = attackDamage; } - public void addAttackDamage(int attackDamage) { - this.attackDamage += attackDamage; + /** + * @param attackDamage attackDamage to be added to the card + */ + public void addAttackDamage(final int addedAttackDamage) { + this.attackDamage += addedAttackDamage; } - public void removeAttackDamage(int attackDamage) { - this.attackDamage -= attackDamage; - if (this.attackDamage < 0) + /** + * @param attackDamage points to be removed from the card's attackDamage + */ + public void removeAttackDamage(final int removedAttackDamage) { + this.attackDamage -= removedAttackDamage; + if (this.attackDamage < 0) { this.attackDamage = 0; + } } public boolean isFrozen() { return frozen; } - public void setFrozen(boolean frozen) { + public void setFrozen(final boolean frozen) { this.frozen = frozen; } - public void removeHealth(int health) { - this.health -= health; + /** + * @param health health to be removed from card + */ + public void removeHealth(final int removedHealth) { + this.health -= removedHealth; } - public void useSpecialAbility(MinionCard target) { + /** + * @param target the card on which the ability should be used + */ + public void useSpecialAbility(final MinionCard target) { this.specialAbility.use(this, target); } - public void attackCard(MinionCard card) { + /** + * @param card card to be attacked + */ + public void attackCard(final MinionCard card) { card.removeHealth(attackDamage); } - public void attackHero(HeroCard heroCard) { + /** + * @param heroCard hero to be attacked + */ + public void attackHero(final HeroCard heroCard) { heroCard.removeHealth(attackDamage); } @Override diff --git a/src/main/card/ability/BloodThirst.java b/src/main/card/ability/BloodThirst.java index 3bff871..bba6a13 100644 --- a/src/main/card/ability/BloodThirst.java +++ b/src/main/card/ability/BloodThirst.java @@ -5,9 +5,9 @@ import java.util.ArrayList; -public class BloodThirst implements RowAbility { +public final class BloodThirst implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); cards.forEach(card -> card.addAttackDamage(1)); } diff --git a/src/main/card/ability/EarthBorn.java b/src/main/card/ability/EarthBorn.java index 94a9e9d..f8eb1f5 100644 --- a/src/main/card/ability/EarthBorn.java +++ b/src/main/card/ability/EarthBorn.java @@ -5,9 +5,9 @@ import java.util.ArrayList; -public class EarthBorn implements RowAbility { +public final class EarthBorn implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); cards.forEach(card -> card.addHealth(1)); } diff --git a/src/main/card/ability/Firestorm.java b/src/main/card/ability/Firestorm.java index eb7358d..2d155cd 100644 --- a/src/main/card/ability/Firestorm.java +++ b/src/main/card/ability/Firestorm.java @@ -1,14 +1,13 @@ package main.card.ability; import main.Game; -import main.card.Card; import main.card.MinionCard; import java.util.ArrayList; -public class Firestorm implements RowAbility { +public final class Firestorm implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); cards.forEach(card -> card.removeHealth(1)); } diff --git a/src/main/card/ability/GodsPlan.java b/src/main/card/ability/GodsPlan.java index 090a1e1..638778f 100644 --- a/src/main/card/ability/GodsPlan.java +++ b/src/main/card/ability/GodsPlan.java @@ -2,9 +2,9 @@ import main.card.MinionCard; -public class GodsPlan implements SpecialAbility { +public final class GodsPlan implements SpecialAbility { @Override - public void use(MinionCard attacker, MinionCard target) { + public void use(final MinionCard attacker, final MinionCard target) { target.addHealth(2); } } diff --git a/src/main/card/ability/HeartHound.java b/src/main/card/ability/HeartHound.java index db1923e..3ad36aa 100644 --- a/src/main/card/ability/HeartHound.java +++ b/src/main/card/ability/HeartHound.java @@ -4,18 +4,12 @@ import main.card.MinionCard; import java.util.ArrayList; -import java.util.Comparator; -public class HeartHound implements RowAbility { +public final class HeartHound implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); - MinionCard maxHealth = cards.stream().max(new Comparator() { - @Override - public int compare(MinionCard o1, MinionCard o2) { - return 0; - } - }).get(); + MinionCard maxHealth = cards.stream().max((o1, o2) -> 0).get(); cards.remove(maxHealth); game.placeCardOnTable(maxHealth, game.getMirrorRow(affectedRow)); diff --git a/src/main/card/ability/LowBlow.java b/src/main/card/ability/LowBlow.java index a363568..6f6fc3a 100644 --- a/src/main/card/ability/LowBlow.java +++ b/src/main/card/ability/LowBlow.java @@ -5,16 +5,17 @@ import java.util.ArrayList; -public class LowBlow implements RowAbility { +public final class LowBlow implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); MinionCard maxHealth = null; - for (MinionCard card : - cards) { - if ( maxHealth == null || card.getAttackDamage() >= maxHealth.getAttackDamage()) + for (MinionCard card + : cards) { + if (maxHealth == null || card.getAttackDamage() >= maxHealth.getAttackDamage()) { maxHealth = card; + } } cards.remove(maxHealth); diff --git a/src/main/card/ability/RowAbility.java b/src/main/card/ability/RowAbility.java index 4fe49c7..0093e53 100644 --- a/src/main/card/ability/RowAbility.java +++ b/src/main/card/ability/RowAbility.java @@ -1,11 +1,11 @@ package main.card.ability; import main.Game; -import main.card.Card; -import main.card.MinionCard; - -import java.util.ArrayList; public interface RowAbility { + /** + * @param game instance of Game + * @param affectedRow row on which the ability is used + */ void use(Game game, int affectedRow); -} \ No newline at end of file +} diff --git a/src/main/card/ability/Shapeshift.java b/src/main/card/ability/Shapeshift.java index 5f6e1ab..46da50a 100644 --- a/src/main/card/ability/Shapeshift.java +++ b/src/main/card/ability/Shapeshift.java @@ -2,9 +2,9 @@ import main.card.MinionCard; -public class Shapeshift implements SpecialAbility { +public final class Shapeshift implements SpecialAbility { @Override - public void use(MinionCard attacker, MinionCard target) { + public void use(final MinionCard attacker, final MinionCard target) { int temp = target.getHealth(); target.setHealth(target.getAttackDamage()); target.setAttackDamage(temp); diff --git a/src/main/card/ability/Skyjack.java b/src/main/card/ability/Skyjack.java index e6adb7b..3b0b52d 100644 --- a/src/main/card/ability/Skyjack.java +++ b/src/main/card/ability/Skyjack.java @@ -2,9 +2,9 @@ import main.card.MinionCard; -public class Skyjack implements SpecialAbility { +public final class Skyjack implements SpecialAbility { @Override - public void use(MinionCard attacker, MinionCard target) { + public void use(final MinionCard attacker, final MinionCard target) { int temp = attacker.getHealth(); attacker.setHealth(target.getHealth()); target.setHealth(temp); diff --git a/src/main/card/ability/SpecialAbility.java b/src/main/card/ability/SpecialAbility.java index ff627a3..177befa 100644 --- a/src/main/card/ability/SpecialAbility.java +++ b/src/main/card/ability/SpecialAbility.java @@ -3,5 +3,9 @@ import main.card.MinionCard; public interface SpecialAbility { - public void use(MinionCard attacker, MinionCard target); + /** + * @param attacker card using ability + * @param target card on which the ability is used + */ + void use(MinionCard attacker, MinionCard target); } diff --git a/src/main/card/ability/SubZero.java b/src/main/card/ability/SubZero.java index a05b21e..b19c56e 100644 --- a/src/main/card/ability/SubZero.java +++ b/src/main/card/ability/SubZero.java @@ -5,16 +5,17 @@ import java.util.ArrayList; -public class SubZero implements RowAbility { +public final class SubZero implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); MinionCard maxHealth = cards.get(0); - for (MinionCard card : - cards) { - if (card.getAttackDamage() > maxHealth.getAttackDamage()) + for (MinionCard card + : cards) { + if (card.getAttackDamage() > maxHealth.getAttackDamage()) { maxHealth = card; + } } maxHealth.setFrozen(true); diff --git a/src/main/card/ability/WeakKnees.java b/src/main/card/ability/WeakKnees.java index a7f0cf4..7fed0ed 100644 --- a/src/main/card/ability/WeakKnees.java +++ b/src/main/card/ability/WeakKnees.java @@ -2,9 +2,9 @@ import main.card.MinionCard; -public class WeakKnees implements SpecialAbility { +public final class WeakKnees implements SpecialAbility { @Override - public void use(MinionCard attacker, MinionCard target) { + public void use(final MinionCard attacker, final MinionCard target) { target.removeAttackDamage(2); } } diff --git a/src/main/card/ability/Winterfell.java b/src/main/card/ability/Winterfell.java index b0dfaa7..79e33c7 100644 --- a/src/main/card/ability/Winterfell.java +++ b/src/main/card/ability/Winterfell.java @@ -5,9 +5,9 @@ import java.util.ArrayList; -public class Winterfell implements RowAbility { +public final class Winterfell implements RowAbility { @Override - public void use(Game game, int affectedRow) { + public void use(final Game game, final int affectedRow) { ArrayList cards = game.getRow(affectedRow); cards.forEach(card -> card.setFrozen(true)); } diff --git a/src/main/command/CardUsesAbility.java b/src/main/command/CardUsesAbility.java index 12c5f3f..447ce67 100644 --- a/src/main/command/CardUsesAbility.java +++ b/src/main/command/CardUsesAbility.java @@ -5,19 +5,21 @@ import main.Game; import main.card.MinionCard; -public class CardUsesAbility implements Command { - Game game; - Coordinates attacker; - Coordinates defender; +public final class CardUsesAbility implements Command { + private final Game game; + private final Coordinates attacker; + private final Coordinates defender; - public CardUsesAbility(Game game, Coordinates attacker, Coordinates defender) { + public CardUsesAbility(final Game game, + final Coordinates attacker, + final Coordinates defender) { this.game = game; this.attacker = attacker; this.defender = defender; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { MinionCard card = game.getCardAtPosition(attacker.getX(), attacker.getY()); boolean error = false; String errorMessage = null; @@ -43,7 +45,9 @@ public void execute(ArrayNode output) { if (!game.rowBelongsToEnemy(defender.getX())) { error = true; errorMessage = "Attacked card does not belong to the enemy."; - } else if (target != null && game.enemyHasTanks() && !Game.TANK_CARDS.contains(target.getName())) { + } else if (target != null + && game.enemyHasTanks() + && !Game.TANK_CARDS.contains(target.getName())) { error = true; errorMessage = "Attacked card is not of type 'Tank'."; } diff --git a/src/main/command/CardUsesAttack.java b/src/main/command/CardUsesAttack.java index 5f12a1c..7058919 100644 --- a/src/main/command/CardUsesAttack.java +++ b/src/main/command/CardUsesAttack.java @@ -5,20 +5,21 @@ import main.Game; import main.card.MinionCard; -public class CardUsesAttack implements Command { - Game game; - Coordinates attacker; - Coordinates defender; +public final class CardUsesAttack implements Command { + private final Game game; + private final Coordinates attacker; + private final Coordinates defender; - public CardUsesAttack(Game game, Coordinates attacker, Coordinates defender) { + public CardUsesAttack(final Game game, + final Coordinates attacker, + final Coordinates defender) { this.game = game; this.attacker = attacker; this.defender = defender; } @Override - public void execute(ArrayNode output) { - + public void execute(final ArrayNode output) { boolean error = false; String errorMessage = null; if (!game.rowBelongsToEnemy(defender.getX())) { @@ -55,8 +56,9 @@ public void execute(ArrayNode output) { .put("error", errorMessage); } else { MinionCard enemy = game.getCardAtPosition(defender.getX(), defender.getY()); - if (enemy == null) + if (enemy == null) { return; + } card.attackCard(enemy); game.cardHasAttacked(card); diff --git a/src/main/command/Command.java b/src/main/command/Command.java index 15f63ea..a3be8a4 100644 --- a/src/main/command/Command.java +++ b/src/main/command/Command.java @@ -3,5 +3,9 @@ import com.fasterxml.jackson.databind.node.ArrayNode; public interface Command { - public void execute(ArrayNode output); + /** + * Interface used for command classes + */ + + void execute(ArrayNode output); } diff --git a/src/main/command/EndPlayerTurn.java b/src/main/command/EndPlayerTurn.java index 1a45b75..1820f4c 100644 --- a/src/main/command/EndPlayerTurn.java +++ b/src/main/command/EndPlayerTurn.java @@ -3,15 +3,15 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Game; -public class EndPlayerTurn implements Command { - Game game; +public final class EndPlayerTurn implements Command { + private final Game game; - public EndPlayerTurn(Game game) { + public EndPlayerTurn(final Game game) { this.game = game; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { game.endCurrentTurn(); game.resetHaveAttacked(); game.removeDeadCards(); diff --git a/src/main/command/GetCardAtPosition.java b/src/main/command/GetCardAtPosition.java index b6aa83d..f10040a 100644 --- a/src/main/command/GetCardAtPosition.java +++ b/src/main/command/GetCardAtPosition.java @@ -2,27 +2,28 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Game; -import main.card.Card; import main.card.MinionCard; -public class GetCardAtPosition implements Command { - Game game; - int x; - int y; +public final class GetCardAtPosition implements Command { + private final Game game; + private final int x; + private final int y; - public GetCardAtPosition(Game game, int x, int y) { + public GetCardAtPosition(final Game game, final int x, final int y) { this.game = game; this.x = x; this.y = y; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { MinionCard card = game.getCardAtPosition(x, y); output.addObject() .put("command", "getCardAtPosition") - .putPOJO("output", (card != null) ? new MinionCard(card) : "No card available at that position.") + .putPOJO("output", (card != null) + ? new MinionCard(card) + : "No card available at that position.") .put("x", x) .put("y", y); } diff --git a/src/main/command/GetCardsInHand.java b/src/main/command/GetCardsInHand.java index 1b4a9da..7969e3d 100644 --- a/src/main/command/GetCardsInHand.java +++ b/src/main/command/GetCardsInHand.java @@ -3,22 +3,21 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Game; import main.card.Card; -import main.card.EnvironmentCard; import main.card.MinionCard; import java.util.ArrayList; -public class GetCardsInHand implements Command { - Game game; - int playerIdx; +public final class GetCardsInHand implements Command { + private final Game game; + private final int playerIdx; - public GetCardsInHand(Game game, int playerIdx) { + public GetCardsInHand(final Game game, final int playerIdx) { this.game = game; this.playerIdx = playerIdx; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { ArrayList clone = new ArrayList<>(); if ((playerIdx == 1)) { diff --git a/src/main/command/GetCardsOnTable.java b/src/main/command/GetCardsOnTable.java index 6f27951..15153f3 100644 --- a/src/main/command/GetCardsOnTable.java +++ b/src/main/command/GetCardsOnTable.java @@ -2,19 +2,16 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Game; -import main.card.Card; -import java.util.ArrayList; +public final class GetCardsOnTable implements Command { + private final Game game; -public class GetCardsOnTable implements Command { - Game game; - - public GetCardsOnTable(Game game) { + public GetCardsOnTable(final Game game) { this.game = game; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getCardsOnTable") .putPOJO("output", game.getCardsOnTable()); diff --git a/src/main/command/GetEnvironmentCardsInHand.java b/src/main/command/GetEnvironmentCardsInHand.java index 15145df..d70dca5 100644 --- a/src/main/command/GetEnvironmentCardsInHand.java +++ b/src/main/command/GetEnvironmentCardsInHand.java @@ -5,22 +5,20 @@ import main.Player; import main.card.Card; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; -public class GetEnvironmentCardsInHand implements Command { - Game game; - int playerIdx; +public final class GetEnvironmentCardsInHand implements Command { + private final Game game; + private final int playerIdx; - public GetEnvironmentCardsInHand(Game game, int playerIdx) { + public GetEnvironmentCardsInHand(final Game game, final int playerIdx) { this.game = game; this.playerIdx = playerIdx; } @Override - public void execute(ArrayNode output) { - Player player = (game.getPlayerTurn() == 1)? game.getPlayer1() : game.getPlayer2(); + public void execute(final ArrayNode output) { + Player player = (game.getPlayerTurn() == 1) ? game.getPlayer1() : game.getPlayer2(); List envCards = player.getHand().stream() .filter(card -> Game.ENVIRONMENT_CARDS.contains(card.getName())) diff --git a/src/main/command/GetFrozenCardsOnTable.java b/src/main/command/GetFrozenCardsOnTable.java index fcd59ea..f97acc0 100644 --- a/src/main/command/GetFrozenCardsOnTable.java +++ b/src/main/command/GetFrozenCardsOnTable.java @@ -6,15 +6,15 @@ import java.util.ArrayList; -public class GetFrozenCardsOnTable implements Command { - Game game; +public final class GetFrozenCardsOnTable implements Command { + private final Game game; - public GetFrozenCardsOnTable(Game game) { + public GetFrozenCardsOnTable(final Game game) { this.game = game; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { ArrayList cards = new ArrayList<>(); game.getCardsOnTable().forEach(row -> { row.stream() diff --git a/src/main/command/GetPlayerDeck.java b/src/main/command/GetPlayerDeck.java index af27df4..cde9ddf 100644 --- a/src/main/command/GetPlayerDeck.java +++ b/src/main/command/GetPlayerDeck.java @@ -1,23 +1,22 @@ package main.command; import com.fasterxml.jackson.databind.node.ArrayNode; -import main.Deck; import main.Game; import main.card.Card; import java.util.ArrayList; -public class GetPlayerDeck implements Command { - Game game; - int playerIdx; +public final class GetPlayerDeck implements Command { + private final Game game; + private final int playerIdx; - public GetPlayerDeck(Game game, int playerIdx) { + public GetPlayerDeck(final Game game, final int playerIdx) { this.game = game; this.playerIdx = playerIdx; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getPlayerDeck") .put("playerIdx", playerIdx) diff --git a/src/main/command/GetPlayerHero.java b/src/main/command/GetPlayerHero.java index fb67215..10e2fbf 100644 --- a/src/main/command/GetPlayerHero.java +++ b/src/main/command/GetPlayerHero.java @@ -4,17 +4,17 @@ import main.Game; import main.card.HeroCard; -public class GetPlayerHero implements Command { - Game game; - int playerIdx; +public final class GetPlayerHero implements Command { + private final Game game; + private final int playerIdx; - public GetPlayerHero(Game game, int playerIdx) { + public GetPlayerHero(final Game game, final int playerIdx) { this.game = game; this.playerIdx = playerIdx; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getPlayerHero") .put("playerIdx", playerIdx) diff --git a/src/main/command/GetPlayerMana.java b/src/main/command/GetPlayerMana.java index 0313064..0c348b3 100644 --- a/src/main/command/GetPlayerMana.java +++ b/src/main/command/GetPlayerMana.java @@ -4,18 +4,18 @@ import main.Game; import main.Player; -public class GetPlayerMana implements Command { - Game game; - int playerIdx; +public final class GetPlayerMana implements Command { + private final Game game; + private final int playerIdx; - public GetPlayerMana(Game game, int playerIdx) { + public GetPlayerMana(final Game game, final int playerIdx) { this.game = game; this.playerIdx = playerIdx; } @Override - public void execute(ArrayNode output) { - Player player = (playerIdx == 1)? game.getPlayer1() : game.getPlayer2(); + public void execute(final ArrayNode output) { + Player player = (playerIdx == 1) ? game.getPlayer1() : game.getPlayer2(); output.addObject() .put("command", "getPlayerMana") diff --git a/src/main/command/GetPlayerOneWins.java b/src/main/command/GetPlayerOneWins.java index 10c3455..6f1ccf2 100644 --- a/src/main/command/GetPlayerOneWins.java +++ b/src/main/command/GetPlayerOneWins.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Statistics; -public class GetPlayerOneWins implements Command { +public final class GetPlayerOneWins implements Command { @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getPlayerOneWins") .put("output", Statistics.getInstance().getPlayer1Wins()); diff --git a/src/main/command/GetPlayerTurn.java b/src/main/command/GetPlayerTurn.java index f32f294..ac895c5 100644 --- a/src/main/command/GetPlayerTurn.java +++ b/src/main/command/GetPlayerTurn.java @@ -3,15 +3,15 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Game; -public class GetPlayerTurn implements Command { - Game game; +public final class GetPlayerTurn implements Command { + private final Game game; - public GetPlayerTurn(Game game) { + public GetPlayerTurn(final Game game) { this.game = game; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getPlayerTurn") .put("output", game.getPlayerTurn()); diff --git a/src/main/command/GetPlayerTwoWins.java b/src/main/command/GetPlayerTwoWins.java index 4171fe9..c4b2d7c 100644 --- a/src/main/command/GetPlayerTwoWins.java +++ b/src/main/command/GetPlayerTwoWins.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Statistics; -public class GetPlayerTwoWins implements Command { +public final class GetPlayerTwoWins implements Command { @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getPlayerTwoWins") .put("output", Statistics.getInstance().getPlayer2Wins()); diff --git a/src/main/command/GetTotalGamesPlayed.java b/src/main/command/GetTotalGamesPlayed.java index 4094d9a..c30c04c 100644 --- a/src/main/command/GetTotalGamesPlayed.java +++ b/src/main/command/GetTotalGamesPlayed.java @@ -3,9 +3,9 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import main.Statistics; -public class GetTotalGamesPlayed implements Command { +public final class GetTotalGamesPlayed implements Command { @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { output.addObject() .put("command", "getTotalGamesPlayed") .put("output", Statistics.getInstance().getGamesPlayed()); diff --git a/src/main/command/PlaceCard.java b/src/main/command/PlaceCard.java index 8385c60..88232bd 100644 --- a/src/main/command/PlaceCard.java +++ b/src/main/command/PlaceCard.java @@ -6,18 +6,18 @@ import main.card.Card; import main.card.MinionCard; -public class PlaceCard implements Command { - Game game; - int handIdx; +public final class PlaceCard implements Command { + private final Game game; + private final int handIdx; - public PlaceCard(Game game, int handIdx) { + public PlaceCard(final Game game, final int handIdx) { this.game = game; this.handIdx = handIdx; } @Override - public void execute(ArrayNode output) { - Player player = (game.getPlayerTurn() == 1)? game.getPlayer1() : game.getPlayer2(); + public void execute(final ArrayNode output) { + Player player = (game.getPlayerTurn() == 1) ? game.getPlayer1() : game.getPlayer2(); Card card = player.getHand().get(handIdx); diff --git a/src/main/command/UseAttackHero.java b/src/main/command/UseAttackHero.java index 2c1fd21..f3c732c 100644 --- a/src/main/command/UseAttackHero.java +++ b/src/main/command/UseAttackHero.java @@ -6,17 +6,17 @@ import main.Statistics; import main.card.MinionCard; -public class UseAttackHero implements Command { - Game game; - Coordinates attacker; +public final class UseAttackHero implements Command { + private final Game game; + private final Coordinates attacker; - public UseAttackHero(Game game, Coordinates attacker) { + public UseAttackHero(final Game game, final Coordinates attacker) { this.game = game; this.attacker = attacker; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { MinionCard card = game.getCardAtPosition(attacker.getX(), attacker.getY()); boolean error = false; String errorMessage = null; @@ -50,9 +50,9 @@ public void execute(ArrayNode output) { statistics.addWin(game.getPlayerTurn()); output.addObject() - .put("gameEnded", "Player " + - ((game.getPlayerTurn() == 1)? "one" : "two") + - " killed the enemy hero."); + .put("gameEnded", "Player " + + ((game.getPlayerTurn() == 1) ? "one" : "two") + + " killed the enemy hero."); } } } diff --git a/src/main/command/UseEnvironmentCard.java b/src/main/command/UseEnvironmentCard.java index 2a3b6e9..ec56277 100644 --- a/src/main/command/UseEnvironmentCard.java +++ b/src/main/command/UseEnvironmentCard.java @@ -6,20 +6,20 @@ import main.card.Card; import main.card.EnvironmentCard; -public class UseEnvironmentCard implements Command { - Game game; - int handIdx; - int affectedRow; +public final class UseEnvironmentCard implements Command { + private final Game game; + private final int handIdx; + private final int affectedRow; - public UseEnvironmentCard(Game game, int handIdx, int affectedRow) { + public UseEnvironmentCard(final Game game, final int handIdx, final int affectedRow) { this.game = game; this.handIdx = handIdx; this.affectedRow = affectedRow; } @Override - public void execute(ArrayNode output) { - Player player = (game.getPlayerTurn() == 1)? game.getPlayer1() : game.getPlayer2(); + public void execute(final ArrayNode output) { + Player player = (game.getPlayerTurn() == 1) ? game.getPlayer1() : game.getPlayer2(); Card card = player.getHand().get(handIdx); @@ -37,7 +37,8 @@ public void execute(ArrayNode output) { } - if (card.getName().equals("Heart Hound") && game.isRowFull(game.getMirrorRow(affectedRow))) { + if (card.getName().equals("Heart Hound") + && game.isRowFull(game.getMirrorRow(affectedRow))) { error = true; errorMessage = "Cannot steal enemy card since the player's row is full."; } diff --git a/src/main/command/UseHeroAbility.java b/src/main/command/UseHeroAbility.java index a2c683a..2628581 100644 --- a/src/main/command/UseHeroAbility.java +++ b/src/main/command/UseHeroAbility.java @@ -5,20 +5,20 @@ import main.Player; import main.card.HeroCard; -public class UseHeroAbility implements Command { - Game game; - int affectedRow; +public final class UseHeroAbility implements Command { + private final Game game; + private final int affectedRow; - public UseHeroAbility(Game game, int affectedRow) { + public UseHeroAbility(final Game game, final int affectedRow) { this.game = game; this.affectedRow = affectedRow; } @Override - public void execute(ArrayNode output) { + public void execute(final ArrayNode output) { boolean error = false; String errorMessage = null; - Player player = (game.getPlayerTurn() == 1)? game.getPlayer1() : game.getPlayer2(); + Player player = (game.getPlayerTurn() == 1) ? game.getPlayer1() : game.getPlayer2(); HeroCard hero = player.getHeroCard(); if (player.getMana() < hero.getMana()) {