[refactoring][filters] Unneeded use of generics was removed

This commit is contained in:
North 2012-07-14 09:57:47 +03:00
parent 5bd9c13543
commit 5450a65421
44 changed files with 78 additions and 89 deletions

View file

@ -68,7 +68,7 @@ public class SecondGuess extends CardImpl<SecondGuess> {
} }
} }
class FilterSecondSpell extends FilterSpell<FilterSecondSpell> { class FilterSecondSpell extends FilterSpell {
public FilterSecondSpell() { public FilterSecondSpell() {
super("spell that's the second spell cast this turn"); super("spell that's the second spell cast this turn");
@ -119,16 +119,14 @@ class FilterSecondSpell extends FilterSpell<FilterSecondSpell> {
return new FilterSecondSpell(this); return new FilterSecondSpell(this);
} }
@Override
public void setFromZone(Constants.Zone fromZone) { public void setFromZone(Constants.Zone fromZone) {
this.fromZone = fromZone; this.fromZone = fromZone;
} }
@Override
public void setNotFromZone(boolean notFromZone) { public void setNotFromZone(boolean notFromZone) {
this.notFromZone = notFromZone; this.notFromZone = notFromZone;
} }
} }

View file

@ -82,7 +82,7 @@ public class EvilTwin extends CardImpl<EvilTwin> {
} }
} }
class EvilTwinFilter extends FilterCreaturePermanent<EvilTwinFilter> { class EvilTwinFilter extends FilterCreaturePermanent {
public EvilTwinFilter() { public EvilTwinFilter() {
super("creature with the same name as this creature"); super("creature with the same name as this creature");

View file

@ -65,7 +65,7 @@ public class UrgentExorcism extends CardImpl<UrgentExorcism> {
} }
} }
class FilterSpiritOrEnchantment extends FilterPermanent<FilterSpiritOrEnchantment> { class FilterSpiritOrEnchantment extends FilterPermanent {
public FilterSpiritOrEnchantment() { public FilterSpiritOrEnchantment() {
super("Spirit or enchantment"); super("Spirit or enchantment");

View file

@ -41,7 +41,7 @@ import java.util.List;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterAbility<T extends Ability> extends FilterImpl<T, FilterAbility<T>> { public class FilterAbility<T extends Ability> extends FilterImpl<T> {
protected static ListComparer<Outcome> compOutcome = new ListComparer<Outcome>(); protected static ListComparer<Outcome> compOutcome = new ListComparer<Outcome>();

View file

@ -38,7 +38,7 @@ import java.util.*;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterCard<T extends FilterCard<T>> extends FilterObject<Card, FilterCard<T>> { public class FilterCard extends FilterObject<Card> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -62,7 +62,7 @@ public class FilterCard<T extends FilterCard<T>> extends FilterObject<Card, Filt
super(name); super(name);
} }
public FilterCard(FilterCard<T> filter) { public FilterCard(FilterCard filter) {
super(filter); super(filter);
this.ownerId.addAll(filter.ownerId); this.ownerId.addAll(filter.ownerId);
this.notOwner = filter.notOwner; this.notOwner = filter.notOwner;
@ -187,7 +187,7 @@ public class FilterCard<T extends FilterCard<T>> extends FilterObject<Card, Filt
} }
@Override @Override
public FilterCard<T> copy() { public FilterCard copy() {
return new FilterCard<T>(this); return new FilterCard(this);
} }
} }

View file

@ -38,14 +38,14 @@ import mage.game.Game;
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
* @author North * @author North
*/ */
public abstract class FilterImpl<E, T extends FilterImpl<E, T>> implements Filter<E> { public abstract class FilterImpl<E> implements Filter<E> {
protected List<Predicate> predicates = new ArrayList<Predicate>(); protected List<Predicate> predicates = new ArrayList<Predicate>();
protected String message; protected String message;
protected boolean notFilter = false; protected boolean notFilter = false;
@Override @Override
public abstract FilterImpl<E, T> copy(); public abstract FilterImpl<E> copy();
public FilterImpl(String name) { public FilterImpl(String name) {
this.message = name; this.message = name;

View file

@ -34,11 +34,11 @@ import mage.MageObject;
* *
* @author North * @author North
*/ */
public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> extends FilterImpl<E, T> { public class FilterObject<E extends MageObject> extends FilterImpl<E> {
@Override @Override
public FilterObject<E, T> copy() { public FilterObject<E> copy() {
return new FilterObject<E, T>(this); return new FilterObject<E>(this);
} }
public FilterObject(String name) { public FilterObject(String name) {

View file

@ -40,7 +40,7 @@ import java.util.UUID;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<Permanent, FilterPermanent<T>> { public class FilterPermanent extends FilterObject<Permanent> {
protected List<UUID> ownerId = new ArrayList<UUID>(); protected List<UUID> ownerId = new ArrayList<UUID>();
protected boolean notOwner; protected boolean notOwner;
protected List<UUID> controllerId = new ArrayList<UUID>(); protected List<UUID> controllerId = new ArrayList<UUID>();
@ -61,7 +61,7 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
super("permanent"); super("permanent");
} }
public FilterPermanent(final FilterPermanent<T> filter) { public FilterPermanent(final FilterPermanent filter) {
super(filter); super(filter);
this.ownerId = new ArrayList<UUID>(filter.ownerId); this.ownerId = new ArrayList<UUID>(filter.ownerId);
this.notOwner = filter.notOwner; this.notOwner = filter.notOwner;
@ -227,8 +227,8 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
} }
@Override @Override
public FilterPermanent<T> copy() { public FilterPermanent copy() {
return new FilterPermanent<T>(this); return new FilterPermanent(this);
} }
} }

View file

@ -40,7 +40,7 @@ import java.util.UUID;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterPlayer extends FilterImpl<Player, FilterPlayer> implements Filter<Player> { public class FilterPlayer extends FilterImpl<Player> {
protected List<UUID> playerId = new ArrayList<UUID>(); protected List<UUID> playerId = new ArrayList<UUID>();
protected boolean notPlayer; protected boolean notPlayer;

View file

@ -39,7 +39,7 @@ import java.util.UUID;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterSpell<T extends FilterSpell<T>> extends FilterStackObject<FilterSpell<T>> { public class FilterSpell extends FilterStackObject {
protected Zone fromZone = Zone.ALL; protected Zone fromZone = Zone.ALL;
protected boolean notFromZone = false; protected boolean notFromZone = false;

View file

@ -40,7 +40,7 @@ import java.util.UUID;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterStackObject<T extends FilterStackObject<T>> extends FilterObject<StackObject, FilterStackObject<T>> { public class FilterStackObject extends FilterObject<StackObject> {
protected List<UUID> controllerId = new ArrayList<UUID>(); protected List<UUID> controllerId = new ArrayList<UUID>();
protected boolean notController = false; protected boolean notController = false;
@ -54,7 +54,7 @@ public class FilterStackObject<T extends FilterStackObject<T>> extends FilterObj
super(name); super(name);
} }
public FilterStackObject(final FilterStackObject<T> filter) { public FilterStackObject(final FilterStackObject filter) {
super(filter); super(filter);
this.controllerId.addAll(filter.controllerId); this.controllerId.addAll(filter.controllerId);
this.notController = filter.notController; this.notController = filter.notController;

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author nantuko * @author nantuko
*/ */
public class FilterArtifactCard extends FilterCard<FilterArtifactCard> { public class FilterArtifactCard extends FilterCard {
public FilterArtifactCard() { public FilterArtifactCard() {
this("artifact"); this("artifact");

View file

@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
* *
* @author ayratn * @author ayratn
*/ */
public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> extends FilterPermanent<FilterArtifactPermanent<T>> { public class FilterArtifactPermanent extends FilterPermanent {
protected boolean useAttacking; protected boolean useAttacking;
protected boolean attacking; protected boolean attacking;
@ -54,7 +54,7 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
this.add(new CardTypePredicate(CardType.ARTIFACT)); this.add(new CardTypePredicate(CardType.ARTIFACT));
} }
public FilterArtifactPermanent(final FilterArtifactPermanent<T> filter) { public FilterArtifactPermanent(final FilterArtifactPermanent filter) {
super(filter); super(filter);
this.useAttacking = filter.useAttacking; this.useAttacking = filter.useAttacking;
this.attacking = filter.attacking; this.attacking = filter.attacking;
@ -98,7 +98,7 @@ public class FilterArtifactPermanent<T extends FilterArtifactPermanent<T>> exten
} }
@Override @Override
public FilterArtifactPermanent<T> copy() { public FilterArtifactPermanent copy() {
return new FilterArtifactPermanent<T>(this); return new FilterArtifactPermanent(this);
} }
} }

View file

@ -32,7 +32,7 @@ package mage.filter.common;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterAttackingCreature extends FilterCreaturePermanent<FilterAttackingCreature> { public class FilterAttackingCreature extends FilterCreaturePermanent {
public FilterAttackingCreature() { public FilterAttackingCreature() {
this("attacking creature"); this("attacking creature");

View file

@ -32,7 +32,7 @@ package mage.filter.common;
* *
* @author nantuko * @author nantuko
*/ */
public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent<FilterAttackingOrBlockingCreature> { public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent {
public FilterAttackingOrBlockingCreature() { public FilterAttackingOrBlockingCreature() {
this("attacking or blocking creature"); this("attacking or blocking creature");

View file

@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterAura extends FilterPermanent<FilterAura> { public class FilterAura extends FilterPermanent {
public FilterAura() { public FilterAura() {
this("aura"); this("aura");

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public class FilterAuraCard extends FilterCard<FilterAuraCard> { public class FilterAuraCard extends FilterCard {
public FilterAuraCard() { public FilterAuraCard() {
this("aura"); this("aura");

View file

@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterBasicLandCard extends FilterCard<FilterBasicLandCard> { public class FilterBasicLandCard extends FilterCard {
public FilterBasicLandCard() { public FilterBasicLandCard() {
super("basic land card"); super("basic land card");

View file

@ -35,7 +35,7 @@ import mage.game.permanent.Permanent;
* *
* @author North * @author North
*/ */
public class FilterBlockedCreature extends FilterCreaturePermanent<FilterBlockingCreature> { public class FilterBlockedCreature extends FilterCreaturePermanent {
public FilterBlockedCreature() { public FilterBlockedCreature() {
this("blocked creature"); this("blocked creature");

View file

@ -32,7 +32,7 @@ package mage.filter.common;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterBlockingCreature extends FilterCreaturePermanent<FilterBlockingCreature> { public class FilterBlockingCreature extends FilterCreaturePermanent {
public FilterBlockingCreature() { public FilterBlockingCreature() {
this("Blocking creature"); this("Blocking creature");

View file

@ -35,7 +35,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterControlledCreaturePermanent<T extends FilterControlledCreaturePermanent> extends FilterControlledPermanent<FilterControlledCreaturePermanent<T>> { public class FilterControlledCreaturePermanent extends FilterControlledPermanent {
public FilterControlledCreaturePermanent() { public FilterControlledCreaturePermanent() {
this("creature you control"); this("creature you control");

View file

@ -35,7 +35,7 @@ import mage.filter.FilterPermanent;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterControlledPermanent<T extends FilterControlledPermanent<T>> extends FilterPermanent<FilterControlledPermanent<T>> { public class FilterControlledPermanent extends FilterPermanent {
public FilterControlledPermanent() { public FilterControlledPermanent() {
this("permanent you control"); this("permanent you control");

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterCreatureCard extends FilterCard<FilterCreatureCard> { public class FilterCreatureCard extends FilterCard {
public FilterCreatureCard() { public FilterCreatureCard() {
this("creature card"); this("creature card");

View file

@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterCreatureForAttack extends FilterCreaturePermanent<FilterCreatureForAttack> { public class FilterCreatureForAttack extends FilterCreaturePermanent {
public FilterCreatureForAttack() { public FilterCreatureForAttack() {
this(""); this("");

View file

@ -35,7 +35,7 @@ import mage.game.permanent.Permanent;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterCreatureForCombat extends FilterCreaturePermanent<FilterCreatureForCombat> { public class FilterCreatureForCombat extends FilterCreaturePermanent {
public FilterCreatureForCombat() { public FilterCreatureForCombat() {
this(""); this("");

View file

@ -41,7 +41,7 @@ import java.util.UUID;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterCreatureOrPlayer extends FilterImpl<Object, FilterCreatureOrPlayer> implements FilterInPlay<Object> { public class FilterCreatureOrPlayer extends FilterImpl<Object> implements FilterInPlay<Object> {
protected FilterCreaturePermanent creatureFilter; protected FilterCreaturePermanent creatureFilter;
protected FilterPlayer playerFilter; protected FilterPlayer playerFilter;

View file

@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> extends FilterPermanent<FilterCreaturePermanent<T>> { public class FilterCreaturePermanent extends FilterPermanent {
protected boolean useAttacking; protected boolean useAttacking;
protected boolean attacking; protected boolean attacking;
@ -56,7 +56,7 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
this.add(new CardTypePredicate(CardType.CREATURE)); this.add(new CardTypePredicate(CardType.CREATURE));
} }
public FilterCreaturePermanent(final FilterCreaturePermanent<T> filter) { public FilterCreaturePermanent(final FilterCreaturePermanent filter) {
super(filter); super(filter);
this.useAttacking = filter.useAttacking; this.useAttacking = filter.useAttacking;
this.attacking = filter.attacking; this.attacking = filter.attacking;
@ -137,7 +137,7 @@ public class FilterCreaturePermanent<T extends FilterCreaturePermanent<T>> exten
} }
@Override @Override
public FilterCreaturePermanent<T> copy() { public FilterCreaturePermanent copy() {
return new FilterCreaturePermanent<T>(this); return new FilterCreaturePermanent(this);
} }
} }

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author nantuko * @author nantuko
*/ */
public class FilterEnchantment extends FilterPermanent<FilterEnchantment> { public class FilterEnchantment extends FilterPermanent {
public FilterEnchantment() { public FilterEnchantment() {
this("enchantment"); this("enchantment");

View file

@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterEquipment extends FilterPermanent<FilterEquipment> { public class FilterEquipment extends FilterPermanent {
public FilterEquipment() { public FilterEquipment() {
this("equipment"); this("equipment");

View file

@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterFortification extends FilterPermanent<FilterFortification> { public class FilterFortification extends FilterPermanent {
public FilterFortification() { public FilterFortification() {
this("fortification"); this("fortification");

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterLandCard extends FilterCard<FilterLandCard> { public class FilterLandCard extends FilterCard {
public FilterLandCard() { public FilterLandCard() {
this("land card"); this("land card");

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterLandPermanent extends FilterPermanent<FilterLandPermanent> { public class FilterLandPermanent extends FilterPermanent {
public FilterLandPermanent() { public FilterLandPermanent() {
this("land"); this("land");

View file

@ -35,7 +35,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterLegendaryPermanent extends FilterPermanent<FilterLegendaryPermanent> { public class FilterLegendaryPermanent extends FilterPermanent {
public FilterLegendaryPermanent() { public FilterLegendaryPermanent() {
this("legend"); this("legend");

View file

@ -37,7 +37,7 @@ import mage.game.permanent.PermanentToken;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterNonTokenPermanent extends FilterPermanent<FilterNonTokenPermanent> { public class FilterNonTokenPermanent extends FilterPermanent {
public FilterNonTokenPermanent() { public FilterNonTokenPermanent() {
this("nontoken permanent"); this("nontoken permanent");

View file

@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterNonlandCard extends FilterCard<FilterNonlandCard> { public class FilterNonlandCard extends FilterCard {
public FilterNonlandCard() { public FilterNonlandCard() {
this("nonland card"); this("nonland card");

View file

@ -37,7 +37,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterNonlandPermanent extends FilterPermanent<FilterNonlandPermanent> { public class FilterNonlandPermanent extends FilterPermanent {
public FilterNonlandPermanent() { public FilterNonlandPermanent() {
this("nonland permanent"); this("nonland permanent");

View file

@ -37,7 +37,7 @@ import java.util.UUID;
* *
* @author noxx * @author noxx
*/ */
public class FilterNotPairedControlledCreaturePermanent extends FilterControlledCreaturePermanent<FilterNotPairedControlledCreaturePermanent> { public class FilterNotPairedControlledCreaturePermanent extends FilterControlledCreaturePermanent {
public FilterNotPairedControlledCreaturePermanent() { public FilterNotPairedControlledCreaturePermanent() {
this("not paired creature you control"); this("not paired creature you control");

View file

@ -41,7 +41,7 @@ import java.util.UUID;
/** /**
* @author nantuko * @author nantuko
*/ */
public class FilterPermanentOrPlayer extends FilterImpl<Object, FilterPermanentOrPlayer> implements FilterInPlay<Object> { public class FilterPermanentOrPlayer extends FilterImpl<Object> implements FilterInPlay<Object> {
protected FilterPermanent permanentFilter; protected FilterPermanent permanentFilter;
protected FilterPlayer playerFilter; protected FilterPlayer playerFilter;

View file

@ -28,8 +28,6 @@
package mage.filter.common; package mage.filter.common;
import mage.filter.FilterPermanent;
import mage.filter.FilterPlayer;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -41,31 +39,20 @@ import java.util.UUID;
*/ */
public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer { public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer {
protected FilterPermanent permanentFilter;
protected FilterPlayer playerFilter;
public FilterPermanentOrPlayerWithCounter() { public FilterPermanentOrPlayerWithCounter() {
this("player or permanent with counters on them"); this("player or permanent with counters on them");
} }
public FilterPermanentOrPlayerWithCounter(String name, UUID controllerId) { public FilterPermanentOrPlayerWithCounter(String name, UUID controllerId) {
super(name); super(name, controllerId);
permanentFilter = new FilterPermanent();
playerFilter = new FilterPlayer();
permanentFilter.getControllerId().add(controllerId);
playerFilter.getPlayerId().add(controllerId);
} }
public FilterPermanentOrPlayerWithCounter(String name) { public FilterPermanentOrPlayerWithCounter(String name) {
super(name); super(name);
permanentFilter = new FilterPermanent();
playerFilter = new FilterPlayer();
} }
public FilterPermanentOrPlayerWithCounter(final FilterPermanentOrPlayerWithCounter filter) { public FilterPermanentOrPlayerWithCounter(final FilterPermanentOrPlayerWithCounter filter) {
super(filter); super(filter);
this.permanentFilter = filter.permanentFilter.copy();
this.playerFilter = filter.playerFilter.copy();
} }
@Override @Override

View file

@ -28,7 +28,6 @@
package mage.filter.common; package mage.filter.common;
import mage.filter.Filter;
import mage.filter.FilterImpl; import mage.filter.FilterImpl;
import mage.filter.FilterPlayer; import mage.filter.FilterPlayer;
import mage.game.Game; import mage.game.Game;
@ -42,7 +41,7 @@ import java.util.UUID;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterPlaneswalkerOrPlayer extends FilterImpl<Object, FilterPlaneswalkerOrPlayer> implements Filter<Object> { public class FilterPlaneswalkerOrPlayer extends FilterImpl<Object> {
protected FilterPlaneswalkerPermanent planeswalkerFilter; protected FilterPlaneswalkerPermanent planeswalkerFilter;
protected FilterPlayer playerFilter; protected FilterPlayer playerFilter;

View file

@ -36,7 +36,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterPlaneswalkerPermanent extends FilterPermanent<FilterPlaneswalkerPermanent> { public class FilterPlaneswalkerPermanent extends FilterPermanent {
public FilterPlaneswalkerPermanent() { public FilterPlaneswalkerPermanent() {
this("planeswalker"); this("planeswalker");

View file

@ -43,7 +43,7 @@ import java.util.UUID;
* *
* @author LevelX * @author LevelX
*/ */
public class FilterSpellOrPermanent extends FilterImpl<Object, FilterPermanentOrPlayer> implements FilterInPlay<Object> { public class FilterSpellOrPermanent extends FilterImpl<Object> implements FilterInPlay<Object> {
protected FilterPermanent permanentFilter; protected FilterPermanent permanentFilter;
protected FilterSpell spellFilter; protected FilterSpell spellFilter;

View file

@ -28,6 +28,7 @@
package mage.filter.common; package mage.filter.common;
import mage.filter.predicate.Predicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken; import mage.game.permanent.PermanentToken;
@ -36,7 +37,7 @@ import mage.game.permanent.PermanentToken;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class FilterToken<T extends FilterToken<T>> extends FilterCreaturePermanent<FilterToken<T>> { public class FilterToken extends FilterCreaturePermanent {
public FilterToken() { public FilterToken() {
this("creature token"); this("creature token");
@ -44,24 +45,28 @@ public class FilterToken<T extends FilterToken<T>> extends FilterCreaturePermane
public FilterToken(String name) { public FilterToken(String name) {
super(name); super(name);
this.add(new TokenPredicate());
} }
public FilterToken(final FilterToken<T> filter) { public FilterToken(final FilterToken filter) {
super(filter); super(filter);
} }
@Override @Override
public boolean match(Permanent permanent, Game game) { public FilterToken copy() {
if (!(permanent instanceof PermanentToken)) return new FilterToken(this);
return notFilter;
if (!super.match(permanent, game))
return notFilter;
return !notFilter;
} }
@Override private static final class TokenPredicate implements Predicate<Permanent> {
public FilterToken<T> copy() {
return new FilterToken<T>(this); @Override
public boolean apply(Permanent input, Game game) {
return input instanceof PermanentToken;
}
@Override
public String toString() {
return "Token";
}
} }
} }

View file

@ -32,7 +32,7 @@ package mage.filter.common;
* *
* @author noxx * @author noxx
*/ */
public class FilterUntappedCreature extends FilterCreaturePermanent<FilterUntappedCreature> { public class FilterUntappedCreature extends FilterCreaturePermanent {
public FilterUntappedCreature() { public FilterUntappedCreature() {
this("untapped creature"); this("untapped creature");