From da0756452c3a45ec1bc74d5d7a92c6b62ecb650a Mon Sep 17 00:00:00 2001 From: Daniel Grigencha Date: Thu, 5 Dec 2024 04:49:49 +0100 Subject: [PATCH] Updated the JavaDocs in multiple classes, to improve readability. --- .../model/src/main/java/pp/mdga/game/Die.java | 2 -- .../src/main/java/pp/mdga/game/HomeNode.java | 3 ++ .../src/main/java/pp/mdga/game/Node.java | 25 +++++++++++---- .../src/main/java/pp/mdga/game/Piece.java | 32 +++++++++---------- .../main/java/pp/mdga/game/PieceState.java | 2 +- .../main/java/pp/mdga/game/ShieldState.java | 2 +- .../src/main/java/pp/mdga/game/StartNode.java | 3 ++ .../src/main/java/pp/mdga/game/Statistic.java | 14 ++++---- 8 files changed, 49 insertions(+), 34 deletions(-) diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Die.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Die.java index fc013d75..c3b99cf5 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Die.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Die.java @@ -1,7 +1,5 @@ package pp.mdga.game; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.random.RandomGenerator; import java.util.random.RandomGeneratorFactory; diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/HomeNode.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/HomeNode.java index cb373011..f9d9b88f 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/HomeNode.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/HomeNode.java @@ -7,6 +7,9 @@ */ @Serializable public class HomeNode extends Node { + /** + * Constructor. + */ public HomeNode() { super(null); } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java index 921ea970..62180b61 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java @@ -3,22 +3,33 @@ import com.jme3.network.serializing.Serializable; /** - * This class will be used the represent a Node on which the pieces can travel along + * Represents a node on the board. */ @Serializable public class Node { + /** + * The occupant of the node. + */ protected Piece occupant; - public Node(Piece piece){ + /** + * This constructor is used to create a new node object with a given occupant. + * + * @param piece as the occupant of the node. + */ + public Node(Piece piece) { occupant = piece; } - private Node(){ + /** + * This constructor is used to create a new node object with a default occupant. + */ + private Node() { occupant = new Piece(Color.AIRFORCE, PieceState.WAITING); } /** - * This method is used to get an occupant of the Node. + * This method is used to get an occupant of the node. * * @return the current occupant of the node */ @@ -27,7 +38,7 @@ public Piece getOccupant() { } /** - * This method is used to set a new Occupant + * This method is used to set a new occupant * * @param occupant the new occupant of the node */ @@ -58,9 +69,9 @@ public boolean isOccupied() { * This method will be used to check if the node is occupied by a piece of the given color. * * @param color as the color of the piece as a Color object. - * @return true or false. + * @return true or false. */ public boolean isOccupied(Color color) { - return this.occupant != null && this.occupant.getColor() == color; + return isOccupied() && this.occupant.getColor() == color; } } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Piece.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Piece.java index 8ddb376c..d32f7e83 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Piece.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Piece.java @@ -51,72 +51,72 @@ private Piece() { } /** - * This method is used to get the color of the piece + * Sets the shield state of the piece. * - * @return the color of the piece + * @param shield the new shield state */ public void setShield(ShieldState shield) { this.shield = shield; } /** - * This method is used to get the color of the piece + * Gets the shield state of the piece. * - * @return the color of the piece + * @return the shield state */ public ShieldState getShield() { return shield; } /** - * This method is used to get the color of the piece + * Sets the state of the piece. * - * @param state the state of the piece + * @param state the new state */ public void setState(PieceState state) { this.state = state; } /** - * This method is used to get the color of the piece + * Gets the state of the piece. * - * @return the color of the piece + * @return the state */ public PieceState getState() { return state; } /** - * This method is used to get the color of the piece + * Checks if the piece is shielded. * - * @return the color of the piece + * @return true if the piece is shielded, false otherwise */ public boolean isShielded() { return shield == ShieldState.ACTIVE; } /** - * This method is used to get the color of the piece + * Checks if the shield of a piece is suppressed. * - * @return the color of the piece + * @return true if the shield is suppressed, false otherwise */ public boolean isSuppressed() { return shield == ShieldState.SUPPRESSED; } /** - * This method is used to get the color of the piece + * Gets the color of the piece. * - * @return the color of the piece + * @return the color */ public Color getColor() { return color; } /** - * This method is used to get the color of the piece + * Gets the unique identifier of the piece. * - * @return the color of the piece + * @return the UUID */ public UUID getUuid() { return uuid; diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/PieceState.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/PieceState.java index 3c66f677..745e73d6 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/PieceState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/PieceState.java @@ -22,5 +22,5 @@ public enum PieceState { /** * The piece is finished. */ - HOMEFINISHED; + HOMEFINISHED } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/ShieldState.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/ShieldState.java index 78eee486..6bff3f52 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/ShieldState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/ShieldState.java @@ -15,5 +15,5 @@ public enum ShieldState { /** * The shield is suppressed, when the piece is on a start node. */ - SUPPRESSED; + SUPPRESSED } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/StartNode.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/StartNode.java index c8c79264..0033738f 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/StartNode.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/StartNode.java @@ -22,6 +22,9 @@ public StartNode(Color color) { this.color = color; } + /** + * Default constructor for serialization. + */ private StartNode() { super(null); color = Color.NONE; diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Statistic.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Statistic.java index 5acd5d14..8751698a 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Statistic.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Statistic.java @@ -68,7 +68,7 @@ public void setCardsPlayed(int cardsPlayed) { } /** - * This method returns the count of enemyPieces Thrown during the game. + * This method returns the count of enemyPieces thrown during the game. * * @return the count of enemyPieces thrown */ @@ -77,7 +77,7 @@ public int getPiecesThrown() { } /** - * This method sets the new count of enemyPieces Thrown + * This method sets the new count of enemyPieces thrown * * @param piecesThrown the new count of pieces thrown. */ @@ -165,28 +165,28 @@ public void increaseCardsPlayed() { } /** - * This method increases the value of cardsPlayed by 1. + * This method increases the value of piecesThrown by 1. */ public void increasePiecesThrown() { piecesThrown++; } /** - * This method increases the value of cardsPlayed by 1. + * This method increases the value of piecesBeingThrown by 1. */ public void increasePiecesBeingThrown() { piecesBeingThrown++; } /** - * This method increases the value of cardsPlayed by 1. + * This method increases the value of diced6 by 1. */ public void increaseDiced6() { diced6++; } /** - * This method increases the value of cardsPlayed by 1. + * This method increases the value of traveledNodes by 1. */ public void increaseTraveledNodes() { traveledNodes++; @@ -202,7 +202,7 @@ public void increaseTraveledNodes(int nodes) { } /** - * This method increases the value of cardsPlayed by 1. + * This method increases the value of activatedBonusNodes by 1. */ public void increaseActivatedBonusNodes() { activatedBonusNodes++;