package it.polimi.ingsw.gc14.Model; import java.io.Serializable; /** * Abstract base class for all playable cards. * A PlayableCard is characterized by an era value. */ public abstract class PlayableCard implements Serializable { private String idIMG; public String getIdIMG() { return idIMG; } /** * 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{ idIMG="-1"; if (Era>0 && Era<4) { this.Era = Era; } else { throw new IllegalArgumentException(); } } /** * 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 (String idIMG,int Era) throws IllegalArgumentException{ this.idIMG = idIMG; if (Era>0 && Era<4) { this.Era = Era; } else { throw new IllegalArgumentException(); } } /** * Returns the string representation of this playable card. * * @return the string representation of this playable card. */ @Override public String toString() { return "⎕:"; } /** * Prints a string representation of this {@code PlayableCard}. This specific variation is used in the {@code Game}'s * toString to print a more detailed version (in this specific case the two methods are equal). * @return {@code String} - a string representation of this {@code PlayableCard}. * @see it.polimi.ingsw.gc14.Model.Game Game * @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board */ public String toStringBoard() { return "⎕:"; } }