Coverage Summary for Class: StatefulEffect (it.polimi.ingsw.Model)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| StatefulEffect | 100% (1/1) | 100% (1/1) | 100% (2/2) |
1 package it.polimi.ingsw.Model; 2 3 import it.polimi.ingsw.Model.Enums.StateType; 4 5 import java.io.Serial; 6 import java.io.Serializable; 7 import java.util.List; 8 9 /** 10 * A {@link CharacterCard} that implements an effect linked to some internal state 11 */ 12 public abstract class StatefulEffect extends CharacterCard implements Serializable { 13 @Serial 14 private static final long serialVersionUID = 127L; // convention: 1 for model, (01 -> 99) for objects 15 protected final StateType stateType; 16 17 /** 18 * Construct a stateful card object 19 * 20 * @param id the ID of the card 21 * @param cost the cost of the card 22 * @param stateType the {@link StateType} of the card 23 * @param context a reference to the Model, to apply the effect. 24 */ 25 public StatefulEffect(int id, int cost, StateType stateType, Model context) { 26 super(id, cost, context); 27 this.stateType = stateType; 28 } 29 30 /** 31 * Get the internal state of the card. Use {@link #getStateType()} to know how to interpret it. 32 * 33 * @return a {@link List} of the state objects 34 */ 35 public abstract List<Object> getState(); 36 37 /** 38 * Get the type of state this card uses. 39 * 40 * @return a variant of {@link StateType} 41 */ 42 public abstract StateType getStateType(); 43 }