Coverage Summary for Class: Character (it.polimi.ingsw.gc14.Model.Cards.TribeCards)
| Class |
Class, %
|
Method, %
|
Line, %
|
| Character |
100%
(1/1)
|
100%
(6/6)
|
100%
(10/10)
|
package it.polimi.ingsw.gc14.Model.Cards.TribeCards;
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
import it.polimi.ingsw.gc14.Model.Player;
/**
* Abstract base class for all character cards.
*
* <p>A Character is a {@link TribeCard} that is not an event card and is associated
* with a specific {@link CharacterType}.
*/
public abstract class Character extends TribeCard implements Cloneable {
/**
* The specific type of this character card.
*/
private CharacterType type;
/**
* Returns the type of this character card.
*
* @return the type of this character card.
*/
public CharacterType getType() {
return type;
}
/**
* Creates a character card with the specified era and character type.
*
* @param Era the era of the character card.
* @param type the type of the character card.
*/
public Character(int Era, CharacterType type){
super(Era,false );
this.type = type;
}
/**
* Creates a character card with the specified image id, era and character type.
*
* @param idIMG the image identifier of the character card.
* @param Era the era of the character card.
* @param type the type of the character card.
*/
public Character(String idIMG,int Era, CharacterType type){
super(idIMG,Era,false );
this.type = type;
}
/**
* Creates a character card with the specified era, character type,
* and minimum number of players.
*
* @param Era the era of the character card.
* @param type the type of the character card.
* @param nMin the minimum number of players required for the card.
*/
public Character(int Era, CharacterType type,int nMin){
super(Era,false ,nMin);
this.type = type;
}
/**
* Creates a character card with the specified image id, era, character type,
* and minimum number of players.
*
* @param idIMG the image identifier of the character card.
* @param Era the era of the character card.
* @param type the type of the character card.
* @param nMin the minimum number of players required for the card.
*/
public Character(String idIMG,int Era, CharacterType type,int nMin){
super(idIMG,Era,false ,nMin);
this.type = type;
}
/**
* Returns a string representation of this {@code Character}. This specific variation is used in the {@code Game}'s
* toString to provide a more detailed version.
* <p>Includes:
* <li>{@link it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType Type}
* </p>
* @return {@code String} - a string representation of this {@code Character}.
* @see it.polimi.ingsw.gc14.Model.Game Game
* @see it.polimi.ingsw.gc14.Model.GamePackage.Board Board
*/
@Override
public String toStringBoard()
{
return super.toStringBoard()+" "+getType().toString()+" ";
}
/**
* Creates and returns a copy of this character card.
*
* @return a clone of this character card.
*/
@Override
public abstract Character clone();
/**
* Inserts this character card into the appropriate collection of the specified player.
*
* @param player the player who receives the character card.
*/
public abstract void insert(Player player);
}