Add: Javadoc for PlayableCard class

This commit is contained in:
MatteoPellegrino05
2026-04-19 15:34:49 +02:00
parent c2500292f0
commit ec9c236932
@@ -1,10 +1,31 @@
package it.polimi.ingsw.gc14.Model;
/**
* Abstract base class for all playable cards.
* A PlayableCard is characterized by an era value.
*/
public abstract class PlayableCard {
/**
* The era associated with this playable card.
*/
private int Era;
/**
* Returns the era of this playable card.
*
* @return the era of this playable card.
*/
public int getEra(){
return Era;
}
/**
* Creates a playable card with the specified era.
*
* @param Era the era of the playable card.
* @throws IllegalArgumentException if {@code Era <= 0} or {@code Era >= 4}.
*/
public PlayableCard (int Era) throws IllegalArgumentException{
if (Era>0 && Era<4) {
this.Era = Era;
@@ -13,6 +34,11 @@ public abstract class PlayableCard {
}
}
/**
* Returns the string representation of this playable card.
*
* @return the string representation of this playable card.
*/
@Override
public String toString() {
return "Era:"+String.valueOf(Era);