Coverage Summary for Class: OrderPlayer (it.polimi.ingsw.gc14.Model.Orders)
| Class |
Class, %
|
Method, %
|
Line, %
|
| OrderPlayer |
100%
(1/1)
|
100%
(5/5)
|
100%
(7/7)
|
package it.polimi.ingsw.gc14.Model.Orders;
import it.polimi.ingsw.gc14.Model.Player;
import java.io.Serializable;
/**
* Represents a player entry in an order logic card.
*
* <p>Each entry stores the player and whether that player has already
* performed an action in the current order sequence.
*/
public class OrderPlayer implements Serializable {
/**
* The player associated with this order entry.
*/
private final Player player;
/**
* Indicates whether the player has already played.
*/
private boolean played;
/**
* Returns the player associated with this order entry.
*
* @return the player.
*/
public Player getPlayer() {
return player;
}
/**
* Returns whether the player has already played in this order sequence.
*
* @return {@code true} if the player has played; {@code false} otherwise.
*/
public boolean isPlayed() {
return played;
}
/**
* Marks this player as having played in the current order sequence.
*/
public void markAsPlayed() {
this.played = true;
}
/**
* Creates an order entry for the specified player.
*
* @param player the player associated with this order entry.
* @param played {@code true} if the player has already played;
* {@code false} otherwise.
*/
public OrderPlayer(Player player, boolean played) {
this.player = player;
this.played = played;
}
/**
* Returns a string containing the player's username and whether the player
* has already played.
*
* @return the string containing the username and whether the player has played.
*/
@Override
public String toString() {
return player.getUserName() + " " + played;
}
}