Updated the JavaDocs in multiple classes, to improve readability.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
*/
|
||||
@Serializable
|
||||
public class HomeNode extends Node {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public HomeNode() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,5 +22,5 @@ public enum PieceState {
|
||||
/**
|
||||
* The piece is finished.
|
||||
*/
|
||||
HOMEFINISHED;
|
||||
HOMEFINISHED
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ public enum ShieldState {
|
||||
/**
|
||||
* The shield is suppressed, when the piece is on a start node.
|
||||
*/
|
||||
SUPPRESSED;
|
||||
SUPPRESSED
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ public StartNode(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor for serialization.
|
||||
*/
|
||||
private StartNode() {
|
||||
super(null);
|
||||
color = Color.NONE;
|
||||
|
||||
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user