Coverage Summary for Class: PlayableCard (it.polimi.ingsw.gc14.Model)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
| PlayableCard |
100%
(1/1)
|
100%
(6/6)
|
100%
(8/8)
|
100%
(14/14)
|
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 {
/**
* The image identifier of the playable card.
*/
private String idIMG;
/**
* Returns the image identifier of this playable card.
*
* @return the image identifier of this playable card.
*/
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 image id and era.
*
* @param idIMG the image identifier of the playable card.
* @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 a string representation of this playable card.
*
* @return a string representation of this playable card.
*/
@Override
public String toString() {
return "";
}
/**
* Returns a compact string representation used when rendering the board in the TUI.
*
* @return a compact board representation of this card.
*/
public String toStringBoard() {
return ":";
}
}