added java docs to model/game and wrote the remaining getter and setter

This commit is contained in:
Hanno Fleischer
2024-11-14 15:32:27 +01:00
parent 0e90041209
commit c7b65d949a
4 changed files with 295 additions and 5 deletions

View File

@@ -1,36 +1,75 @@
package pp.mdga.game;
/**
* This class will be used to hold all Piece relevant data.
*/
public class Piece {
private ShieldState shield;
private PieceState state;
private Color color;
/**
* This constructor is used to create a new Piece
*
* @param color the color of the piece
* @param state the state of the piece
*/
public Piece(Color color, PieceState state) {
this.color = color;
this.state = state;
shield = ShieldState.NONE;
}
/**
* This method is used to get the color of the piece
*
* @return the color of the piece
*/
public void setShield(ShieldState shield) {
this.shield = shield;
}
/**
* This method is used to get the color of the piece
*
* @return the color of the piece
*/
public ShieldState getShield() {
return shield;
}
/**
* This method is used to get the color of the piece
*
* @param state the state of the piece
*/
public void setState(PieceState state) {
this.state = state;
}
/**
* This method is used to get the color of the piece
*
* @return the color of the piece
*/
public PieceState getState() {
return state;
}
/**
* This method is used to get the color of the piece
*
* @return the color of the piece
*/
public boolean isShielded() {
return shield == ShieldState.ACTIVE;
}
/**
* This method is used to get the color of the piece
*
* @return the color of the piece
*/
public boolean isSuppressed() {
return shield == ShieldState.SUPPRESSED;
}