From 1867a150c18bef8a22e05b1d562bf571bb29f038 Mon Sep 17 00:00:00 2001 From: North Date: Tue, 3 Jun 2014 11:19:49 +0300 Subject: [PATCH] [refactor] removed generic parameter from Player --- .../src/mage/player/ai/ComputerDraftPlayer.java | 2 +- .../src/mage/player/ai/ComputerPlayer6.java | 2 +- .../src/mage/player/ai/SimulatedPlayer2.java | 2 +- .../src/main/java/mage/player/ai/ComputerPlayer.java | 7 +++---- .../src/mage/player/ai/ComputerPlayerMCTS.java | 2 +- .../src/mage/player/ai/MCTSPlayer.java | 2 +- .../src/mage/player/ai/ComputerPlayer2.java | 2 +- .../src/mage/player/ai/SimulatedPlayer.java | 2 +- .../src/mage/player/human/HumanPlayer.java | 2 +- .../test/java/org/mage/test/player/RandomPlayer.java | 2 +- .../test/java/org/mage/test/player/TestPlayer.java | 2 +- Mage/src/mage/players/PlayerImpl.java | 11 ++--------- 12 files changed, 15 insertions(+), 23 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Player.AI.DraftBot/src/mage/player/ai/ComputerDraftPlayer.java b/Mage.Server.Plugins/Mage.Player.AI.DraftBot/src/mage/player/ai/ComputerDraftPlayer.java index 48bac674da..8f81b43561 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.DraftBot/src/mage/player/ai/ComputerDraftPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI.DraftBot/src/mage/player/ai/ComputerDraftPlayer.java @@ -38,7 +38,7 @@ import mage.players.Player; * * @author nantuko */ -public class ComputerDraftPlayer extends ComputerPlayer implements Player { +public class ComputerDraftPlayer extends ComputerPlayer implements Player { public ComputerDraftPlayer(String name, RangeOfInfluence range) { super(name, range); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index ad8247669a..3a2ae135ac 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -68,7 +68,7 @@ import mage.player.ai.ma.optimizers.impl.OutcomeOptimizer; * * @author nantuko */ -public class ComputerPlayer6 extends ComputerPlayer 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); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index 461e09be3a..b197de6e07 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -59,7 +59,7 @@ import org.apache.log4j.Logger; * * @author BetaSteward_at_googlemail.com */ -public class SimulatedPlayer2 extends ComputerPlayer { +public class SimulatedPlayer2 extends ComputerPlayer { private static final transient Logger logger = Logger.getLogger(SimulatedPlayer2.class); private final boolean isSimulatedPlayer; diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index a665ab16a0..8e61a8e42d 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -91,9 +91,8 @@ import mage.cards.repository.ExpansionRepository; * suitable for two player games and some multiplayer games * * @author BetaSteward_at_googlemail.com - * @param */ -public class ComputerPlayer> extends PlayerImpl implements Player { +public class ComputerPlayer extends PlayerImpl implements Player { private transient final static Logger log = Logger.getLogger(ComputerPlayer.class); private transient Map unplayable = new TreeMap<>(); @@ -1962,8 +1961,8 @@ public class ComputerPlayer> extends PlayerImpl i @Override - public T copy() { - return (T)new ComputerPlayer(this); + public ComputerPlayer copy() { + return new ComputerPlayer(this); } } diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java index 36b9bc806d..19d5b887d8 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java @@ -51,7 +51,7 @@ import java.util.concurrent.Executors; * * @author BetaSteward_at_googlemail.com */ -public class ComputerPlayerMCTS extends ComputerPlayer 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; diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java index 23ebed02e2..423b38ef11 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/MCTSPlayer.java @@ -43,7 +43,7 @@ import java.util.UUID; * * @author BetaSteward_at_googlemail.com */ -public class MCTSPlayer extends ComputerPlayer { +public class MCTSPlayer extends ComputerPlayer { private static final transient Logger logger = Logger.getLogger(MCTSPlayer.class); diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index bbdafd26c2..6008c61935 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -58,7 +58,7 @@ import java.util.concurrent.*; * * @author BetaSteward_at_googlemail.com */ -public class ComputerPlayer2 extends ComputerPlayer 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); diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java index ddb8839d68..4c9deb07a5 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/SimulatedPlayer.java @@ -49,7 +49,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; * * @author BetaSteward_at_googlemail.com */ -public class SimulatedPlayer extends ComputerPlayer { +public class SimulatedPlayer extends ComputerPlayer { private static final transient Logger logger = Logger.getLogger(SimulatedPlayer.class); private boolean isSimulatedPlayer; diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index f6212edd12..7f51ea9930 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -94,7 +94,7 @@ import org.apache.log4j.Logger; * * @author BetaSteward_at_googlemail.com */ -public class HumanPlayer extends PlayerImpl { +public class HumanPlayer extends PlayerImpl { private final transient PlayerResponse response = new PlayerResponse(); diff --git a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java index dc22211674..496cdb05b7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/RandomPlayer.java @@ -54,7 +54,7 @@ import java.util.*; * * @author BetaSteward_at_googlemail.com */ -public class RandomPlayer extends ComputerPlayer { +public class RandomPlayer extends ComputerPlayer { private boolean isSimulatedPlayer; private static Random rnd = new Random(); diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index e728f1ed72..9698564367 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -66,7 +66,7 @@ import mage.game.stack.StackObject; * @author BetaSteward_at_googlemail.com */ @Ignore -public class TestPlayer extends ComputerPlayer { +public class TestPlayer extends ComputerPlayer { private final List actions = new ArrayList<>(); private final List choices = new ArrayList<>(); diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index e5665e95c9..78e5da9122 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -116,11 +116,7 @@ import mage.target.common.TargetDiscard; import mage.watchers.common.BloodthirstWatcher; import org.apache.log4j.Logger; -/** - * - * @param - */ -public abstract class PlayerImpl> 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> 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> implements Player, Ser this.playerId = id; } - public PlayerImpl(final PlayerImpl player) { + public PlayerImpl(final PlayerImpl player) { this.abort = player.abort; this.playerId = player.playerId;