[refactor] removed generic parameter from Game classes

This commit is contained in:
North 2014-06-03 12:33:02 +03:00
parent 4fd248c4f8
commit 9324e93868
27 changed files with 32 additions and 37 deletions

View file

@ -34,7 +34,7 @@ import mage.game.match.MatchType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class CommanderDuelType extends MatchType<CommanderDuelType> { public class CommanderDuelType extends MatchType {
public CommanderDuelType() { public CommanderDuelType() {
this.name = "Commander Two Player Duel"; this.name = "Commander Two Player Duel";

View file

@ -35,7 +35,7 @@ import mage.game.match.MatchType;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class CommanderFreeForAllType extends MatchType<CommanderFreeForAllType> { public class CommanderFreeForAllType extends MatchType {
public CommanderFreeForAllType() { public CommanderFreeForAllType() {
this.name = "Commander Free For All"; this.name = "Commander Free For All";

View file

@ -40,7 +40,7 @@ import mage.players.Player;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FreeForAll extends GameImpl<FreeForAll> { public class FreeForAll extends GameImpl {
private int numPlayers; private int numPlayers;

View file

@ -34,7 +34,7 @@ import mage.game.match.MatchType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FreeForAllType extends MatchType<FreeForAllType> { public class FreeForAllType extends MatchType {
public FreeForAllType() { public FreeForAllType() {
this.name = "Free For All"; this.name = "Free For All";

View file

@ -38,7 +38,7 @@ import mage.game.match.MatchType;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player; import mage.players.Player;
public class TwoPlayerDuel extends GameImpl<TwoPlayerDuel> { public class TwoPlayerDuel extends GameImpl {
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans) { public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans) {
super(attackOption, range, freeMulligans); super(attackOption, range, freeMulligans);

View file

@ -34,7 +34,7 @@ import mage.game.match.MatchType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class TwoPlayerDuelType extends MatchType<TwoPlayerDuelType> { public class TwoPlayerDuelType extends MatchType {
public TwoPlayerDuelType() { public TwoPlayerDuelType() {
this.name = "Two Player Duel"; this.name = "Two Player Duel";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class BoosterDraftEliminationCubeTournamentType extends TournamentType<BoosterDraftEliminationCubeTournamentType> { public class BoosterDraftEliminationCubeTournamentType extends TournamentType {
public BoosterDraftEliminationCubeTournamentType() { public BoosterDraftEliminationCubeTournamentType() {
this.name = "Booster Draft Elimination (Cube)"; this.name = "Booster Draft Elimination (Cube)";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class BoosterDraftEliminationTournamentType extends TournamentType<BoosterDraftEliminationTournamentType> { public class BoosterDraftEliminationTournamentType extends TournamentType {
public BoosterDraftEliminationTournamentType() { public BoosterDraftEliminationTournamentType() {
this.name = "Booster Draft Elimination"; this.name = "Booster Draft Elimination";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class BoosterDraftSwissCubeTournamentType extends TournamentType<BoosterDraftSwissCubeTournamentType> { public class BoosterDraftSwissCubeTournamentType extends TournamentType {
public BoosterDraftSwissCubeTournamentType() { public BoosterDraftSwissCubeTournamentType() {
this.name = "Booster Draft Swiss (Cube)"; this.name = "Booster Draft Swiss (Cube)";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class BoosterDraftSwissTournamentType extends TournamentType<BoosterDraftSwissTournamentType> { public class BoosterDraftSwissTournamentType extends TournamentType {
public BoosterDraftSwissTournamentType() { public BoosterDraftSwissTournamentType() {
this.name = "Booster Draft Swiss"; this.name = "Booster Draft Swiss";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* @author LevelX2 * @author LevelX2
*/ */
public class ConstructedEliminationTournamentType extends TournamentType<ConstructedEliminationTournamentType> { public class ConstructedEliminationTournamentType extends TournamentType {
public ConstructedEliminationTournamentType() { public ConstructedEliminationTournamentType() {
this.name = "Elimination Constructed"; this.name = "Elimination Constructed";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class SealedEliminationCubeTournamentType extends TournamentType<SealedEliminationCubeTournamentType> { public class SealedEliminationCubeTournamentType extends TournamentType {
public SealedEliminationCubeTournamentType() { public SealedEliminationCubeTournamentType() {
this.name = "Sealed Elimination (Cube)"; this.name = "Sealed Elimination (Cube)";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class SealedEliminationTournamentType extends TournamentType<SealedEliminationTournamentType> { public class SealedEliminationTournamentType extends TournamentType {
public SealedEliminationTournamentType() { public SealedEliminationTournamentType() {
this.name = "Sealed Elimination"; this.name = "Sealed Elimination";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class SealedSwissCubeTournamentType extends TournamentType<SealedSwissCubeTournamentType> { public class SealedSwissCubeTournamentType extends TournamentType {
public SealedSwissCubeTournamentType() { public SealedSwissCubeTournamentType() {
this.name = "Sealed Swiss (Cube)"; this.name = "Sealed Swiss (Cube)";

View file

@ -34,7 +34,7 @@ import mage.game.tournament.TournamentType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class SealedSwissTournamentType extends TournamentType<SealedSwissTournamentType> { public class SealedSwissTournamentType extends TournamentType {
public SealedSwissTournamentType() { public SealedSwissTournamentType() {
this.name = "Sealed Swiss"; this.name = "Sealed Swiss";

View file

@ -138,7 +138,7 @@ class PrimalClayEffect extends ContinuousEffectImpl {
} }
} }
class PrimalClayChoice extends ChoiceImpl<PrimalClayChoice> { class PrimalClayChoice extends ChoiceImpl {
PrimalClayChoice() { PrimalClayChoice() {
super(true); super(true);
this.setMessage("Choose for Primal Clay to be"); this.setMessage("Choose for Primal Clay to be");

View file

@ -132,7 +132,7 @@ class PrimalPlasmaEffect extends ContinuousEffectImpl {
return new PrimalPlasmaEffect(this); return new PrimalPlasmaEffect(this);
} }
} }
class PrimalPlasmaChoice extends ChoiceImpl<PrimalPlasmaChoice> { class PrimalPlasmaChoice extends ChoiceImpl {
PrimalPlasmaChoice() { PrimalPlasmaChoice() {
super(true); super(true);
this.choices.add("a 3/3 creature"); this.choices.add("a 3/3 creature");

View file

@ -32,7 +32,7 @@ package mage.choices;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class ChoiceBasicLandType extends ChoiceImpl<ChoiceBasicLandType> { public class ChoiceBasicLandType extends ChoiceImpl {
public ChoiceBasicLandType() { public ChoiceBasicLandType() {
super(true); super(true);

View file

@ -34,7 +34,7 @@ import mage.ObjectColor;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class ChoiceColor extends ChoiceImpl<ChoiceColor> { public class ChoiceColor extends ChoiceImpl {
public ChoiceColor() { public ChoiceColor() {
super(true); super(true);

View file

@ -35,9 +35,8 @@ import java.util.Set;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
* @param <T>
*/ */
public class ChoiceImpl<T extends ChoiceImpl<T>> implements Choice, Serializable { public class ChoiceImpl implements Choice, Serializable {
protected boolean chosen; protected boolean chosen;
protected boolean required; protected boolean required;
@ -53,7 +52,7 @@ public class ChoiceImpl<T extends ChoiceImpl<T>> implements Choice, Serializable
this.required = required; this.required = required;
} }
public ChoiceImpl(ChoiceImpl<T> choice) { public ChoiceImpl(ChoiceImpl choice) {
this.choice = choice.choice; this.choice = choice.choice;
this.chosen = choice.chosen; this.chosen = choice.chosen;
this.required = choice.required; this.required = choice.required;
@ -111,8 +110,8 @@ public class ChoiceImpl<T extends ChoiceImpl<T>> implements Choice, Serializable
} }
@Override @Override
public T copy() { public ChoiceImpl copy() {
return (T)new ChoiceImpl(this); return new ChoiceImpl(this);
} }
} }

View file

@ -33,7 +33,7 @@ package mage.choices;
* @author LevelX2 * @author LevelX2
*/ */
public class ChoiceLeftOrRight extends ChoiceImpl<ChoiceLeftOrRight> { public class ChoiceLeftOrRight extends ChoiceImpl {
public ChoiceLeftOrRight() { public ChoiceLeftOrRight() {
super(true); super(true);

View file

@ -53,7 +53,7 @@ import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import mage.watchers.common.CommanderCombatDamageWatcher; import mage.watchers.common.CommanderCombatDamageWatcher;
public abstract class GameCommanderImpl extends GameImpl<GameCommanderImpl> { public abstract class GameCommanderImpl extends GameImpl {
private final Map<UUID, Cards> mulliganedCards = new HashMap<UUID, Cards>(); private final Map<UUID, Cards> mulliganedCards = new HashMap<UUID, Cards>();
private final Set<CommanderCombatDamageWatcher> commanderCombatWatcher = new HashSet<CommanderCombatDamageWatcher>(); private final Set<CommanderCombatDamageWatcher> commanderCombatWatcher = new HashSet<CommanderCombatDamageWatcher>();

View file

@ -122,7 +122,7 @@ import mage.watchers.common.PlayerLostLifeWatcher;
import mage.watchers.common.SoulbondWatcher; import mage.watchers.common.SoulbondWatcher;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializable { public abstract class GameImpl implements Game, Serializable {
private static final transient Logger logger = Logger.getLogger(GameImpl.class); private static final transient Logger logger = Logger.getLogger(GameImpl.class);
@ -189,9 +189,6 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
private boolean saveGame = false; private boolean saveGame = false;
private int priorityTime; private int priorityTime;
@Override
public abstract T copy();
public GameImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans) { public GameImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans) {
this.id = UUID.randomUUID(); this.id = UUID.randomUUID();
this.range = range; this.range = range;
@ -201,7 +198,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
// this.actions = new LinkedList<MageAction>(); // this.actions = new LinkedList<MageAction>();
} }
public GameImpl(final GameImpl<T> game) { public GameImpl(final GameImpl game) {
long t1 = 0; long t1 = 0;
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
t1 = System.currentTimeMillis(); t1 = System.currentTimeMillis();

View file

@ -35,7 +35,7 @@ import mage.cards.ExpansionSet;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class BoosterDraft extends DraftImpl<BoosterDraft> { public class BoosterDraft extends DraftImpl {
public BoosterDraft(DraftOptions options, List<ExpansionSet> sets) { public BoosterDraft(DraftOptions options, List<ExpansionSet> sets) {
super(options, sets); super(options, sets);

View file

@ -48,9 +48,8 @@ import mage.players.PlayerList;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
* @param <T>
*/ */
public abstract class DraftImpl<T extends DraftImpl<T>> implements Draft { public abstract class DraftImpl implements Draft {
protected final UUID id; protected final UUID id;
protected final Map<UUID, DraftPlayer> players = new HashMap<>(); protected final Map<UUID, DraftPlayer> players = new HashMap<>();

View file

@ -34,7 +34,7 @@ import java.io.Serializable;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public abstract class MatchType<T extends MatchType<T>> implements Serializable { public abstract class MatchType implements Serializable {
protected String name; protected String name;
protected int minPlayers; protected int minPlayers;
@ -56,7 +56,7 @@ public abstract class MatchType<T extends MatchType<T>> implements Serializable
this.useAttackOption = matchType.useAttackOption; this.useAttackOption = matchType.useAttackOption;
} }
public abstract T copy(); public abstract MatchType copy();
@Override @Override
public String toString() { public String toString() {

View file

@ -34,7 +34,7 @@ import java.io.Serializable;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class TournamentType <T extends TournamentType<T>> implements Serializable { public class TournamentType implements Serializable {
protected String name; protected String name;
protected int minPlayers; protected int minPlayers;