[refactor] removed generic parameter from Player

This commit is contained in:
North 2014-06-03 11:19:49 +03:00
parent 99854be1fb
commit 1867a150c1
12 changed files with 15 additions and 23 deletions

View file

@ -38,7 +38,7 @@ import mage.players.Player;
*
* @author nantuko
*/
public class ComputerDraftPlayer extends ComputerPlayer<ComputerDraftPlayer> implements Player {
public class ComputerDraftPlayer extends ComputerPlayer implements Player {
public ComputerDraftPlayer(String name, RangeOfInfluence range) {
super(name, range);

View file

@ -68,7 +68,7 @@ import mage.player.ai.ma.optimizers.impl.OutcomeOptimizer;
*
* @author nantuko
*/
public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements Player {
public class ComputerPlayer6 extends ComputerPlayer implements Player {
private static final transient org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ComputerPlayer6.class);
private static final ExecutorService pool = Executors.newFixedThreadPool(1);

View file

@ -59,7 +59,7 @@ import org.apache.log4j.Logger;
*
* @author BetaSteward_at_googlemail.com
*/
public class SimulatedPlayer2 extends ComputerPlayer<SimulatedPlayer2> {
public class SimulatedPlayer2 extends ComputerPlayer {
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer2.class);
private final boolean isSimulatedPlayer;

View file

@ -91,9 +91,8 @@ import mage.cards.repository.ExpansionRepository;
* suitable for two player games and some multiplayer games
*
* @author BetaSteward_at_googlemail.com
* @param <T>
*/
public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> implements Player {
public class ComputerPlayer extends PlayerImpl implements Player {
private transient final static Logger log = Logger.getLogger(ComputerPlayer.class);
private transient Map<Mana, Card> unplayable = new TreeMap<>();
@ -1962,8 +1961,8 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
@Override
public T copy() {
return (T)new ComputerPlayer(this);
public ComputerPlayer copy() {
return new ComputerPlayer(this);
}
}

View file

@ -51,7 +51,7 @@ import java.util.concurrent.Executors;
*
* @author BetaSteward_at_googlemail.com
*/
public class ComputerPlayerMCTS extends ComputerPlayer<ComputerPlayerMCTS> implements Player {
public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
private static final int THINK_MIN_RATIO = 40;
private static final int THINK_MAX_RATIO = 100;

View file

@ -43,7 +43,7 @@ import java.util.UUID;
*
* @author BetaSteward_at_googlemail.com
*/
public class MCTSPlayer extends ComputerPlayer<MCTSPlayer> {
public class MCTSPlayer extends ComputerPlayer {
private static final transient Logger logger = Logger.getLogger(MCTSPlayer.class);

View file

@ -58,7 +58,7 @@ import java.util.concurrent.*;
*
* @author BetaSteward_at_googlemail.com
*/
public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements Player {
public class ComputerPlayer2 extends ComputerPlayer implements Player {
private static final transient Logger logger = Logger.getLogger(ComputerPlayer2.class);
private static final transient ExecutorService pool = Executors.newFixedThreadPool(1);

View file

@ -49,7 +49,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*
* @author BetaSteward_at_googlemail.com
*/
public class SimulatedPlayer extends ComputerPlayer<SimulatedPlayer> {
public class SimulatedPlayer extends ComputerPlayer {
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer.class);
private boolean isSimulatedPlayer;

View file

@ -94,7 +94,7 @@ import org.apache.log4j.Logger;
*
* @author BetaSteward_at_googlemail.com
*/
public class HumanPlayer extends PlayerImpl<HumanPlayer> {
public class HumanPlayer extends PlayerImpl {
private final transient PlayerResponse response = new PlayerResponse();

View file

@ -54,7 +54,7 @@ import java.util.*;
*
* @author BetaSteward_at_googlemail.com
*/
public class RandomPlayer extends ComputerPlayer<RandomPlayer> {
public class RandomPlayer extends ComputerPlayer {
private boolean isSimulatedPlayer;
private static Random rnd = new Random();

View file

@ -66,7 +66,7 @@ import mage.game.stack.StackObject;
* @author BetaSteward_at_googlemail.com
*/
@Ignore
public class TestPlayer extends ComputerPlayer<TestPlayer> {
public class TestPlayer extends ComputerPlayer {
private final List<PlayerAction> actions = new ArrayList<>();
private final List<String> choices = new ArrayList<>();

View file

@ -116,11 +116,7 @@ import mage.target.common.TargetDiscard;
import mage.watchers.common.BloodthirstWatcher;
import org.apache.log4j.Logger;
/**
*
* @param <T>
*/
public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Serializable {
public abstract class PlayerImpl implements Player, Serializable {
private static final transient Logger log = Logger.getLogger(PlayerImpl.class);
@ -197,9 +193,6 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
protected UserData userData;
@Override
public abstract T copy();
public PlayerImpl(String name, RangeOfInfluence range) {
this(UUID.randomUUID());
this.name = name;
@ -217,7 +210,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.playerId = id;
}
public PlayerImpl(final PlayerImpl<T> player) {
public PlayerImpl(final PlayerImpl player) {
this.abort = player.abort;
this.playerId = player.playerId;