[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
*/
public class CommanderDuelType extends MatchType<CommanderDuelType> {
public class CommanderDuelType extends MatchType {
public CommanderDuelType() {
this.name = "Commander Two Player Duel";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -53,7 +53,7 @@ import mage.players.Player;
import mage.target.common.TargetCardInHand;
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 Set<CommanderCombatDamageWatcher> commanderCombatWatcher = new HashSet<CommanderCombatDamageWatcher>();

View file

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

View file

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

View file

@ -48,9 +48,8 @@ import mage.players.PlayerList;
/**
*
* @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 Map<UUID, DraftPlayer> players = new HashMap<>();

View file

@ -34,7 +34,7 @@ import java.io.Serializable;
*
* @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 int minPlayers;
@ -56,7 +56,7 @@ public abstract class MatchType<T extends MatchType<T>> implements Serializable
this.useAttackOption = matchType.useAttackOption;
}
public abstract T copy();
public abstract MatchType copy();
@Override
public String toString() {

View file

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