Updated the JavaDocs in multiple classes, to improve readability.
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
package pp.mdga.game;
|
package pp.mdga.game;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.random.RandomGenerator;
|
import java.util.random.RandomGenerator;
|
||||||
import java.util.random.RandomGeneratorFactory;
|
import java.util.random.RandomGeneratorFactory;
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
public class HomeNode extends Node {
|
public class HomeNode extends Node {
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
public HomeNode() {
|
public HomeNode() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,33 @@
|
|||||||
import com.jme3.network.serializing.Serializable;
|
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
|
@Serializable
|
||||||
public class Node {
|
public class Node {
|
||||||
|
/**
|
||||||
|
* The occupant of the node.
|
||||||
|
*/
|
||||||
protected Piece occupant;
|
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;
|
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);
|
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
|
* @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
|
* @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.
|
* 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.
|
* @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) {
|
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) {
|
public void setShield(ShieldState shield) {
|
||||||
this.shield = 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() {
|
public ShieldState getShield() {
|
||||||
return shield;
|
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) {
|
public void setState(PieceState state) {
|
||||||
this.state = 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() {
|
public PieceState getState() {
|
||||||
return state;
|
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() {
|
public boolean isShielded() {
|
||||||
return shield == ShieldState.ACTIVE;
|
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() {
|
public boolean isSuppressed() {
|
||||||
return shield == ShieldState.SUPPRESSED;
|
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() {
|
public Color getColor() {
|
||||||
return color;
|
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() {
|
public UUID getUuid() {
|
||||||
return uuid;
|
return uuid;
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ public enum PieceState {
|
|||||||
/**
|
/**
|
||||||
* The piece is finished.
|
* 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.
|
* 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;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor for serialization.
|
||||||
|
*/
|
||||||
private StartNode() {
|
private StartNode() {
|
||||||
super(null);
|
super(null);
|
||||||
color = Color.NONE;
|
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
|
* @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.
|
* @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() {
|
public void increasePiecesThrown() {
|
||||||
piecesThrown++;
|
piecesThrown++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method increases the value of cardsPlayed by 1.
|
* This method increases the value of piecesBeingThrown by 1.
|
||||||
*/
|
*/
|
||||||
public void increasePiecesBeingThrown() {
|
public void increasePiecesBeingThrown() {
|
||||||
piecesBeingThrown++;
|
piecesBeingThrown++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method increases the value of cardsPlayed by 1.
|
* This method increases the value of diced6 by 1.
|
||||||
*/
|
*/
|
||||||
public void increaseDiced6() {
|
public void increaseDiced6() {
|
||||||
diced6++;
|
diced6++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method increases the value of cardsPlayed by 1.
|
* This method increases the value of traveledNodes by 1.
|
||||||
*/
|
*/
|
||||||
public void increaseTraveledNodes() {
|
public void increaseTraveledNodes() {
|
||||||
traveledNodes++;
|
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() {
|
public void increaseActivatedBonusNodes() {
|
||||||
activatedBonusNodes++;
|
activatedBonusNodes++;
|
||||||
|
|||||||
Reference in New Issue
Block a user