[filters][refactoring] Minor changes to Predicates

This commit is contained in:
North 2012-07-12 00:04:44 +03:00
parent 2198cae333
commit dcfd5ece0c
11 changed files with 23 additions and 23 deletions

View file

@ -28,7 +28,7 @@
package mage.filter;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import mage.Constants.CardType;
import mage.filter.predicate.Predicate;
@ -44,7 +44,7 @@ public abstract class FilterImpl<E, T extends FilterImpl<E, T>> implements Filte
protected static ListComparer<CardType> compCardType = new ListComparer<CardType>();
protected static ListComparer<String> compString = new ListComparer<String>();
protected List<Predicate> predicates = new LinkedList<Predicate>();
protected List<Predicate> predicates = new ArrayList<Predicate>();
protected String message;
protected boolean notFilter = false;
@ -58,7 +58,7 @@ public abstract class FilterImpl<E, T extends FilterImpl<E, T>> implements Filte
public FilterImpl(FilterImpl filter) {
this.message = filter.message;
this.notFilter = filter.notFilter;
this.predicates = new LinkedList<Predicate>(filter.predicates);
this.predicates = new ArrayList<Predicate>(filter.predicates);
}
@Override

View file

@ -37,7 +37,7 @@ import mage.game.Game;
*
* @author North
*/
public class AbilityPredicate<T extends MageObject> implements Predicate<T> {
public class AbilityPredicate implements Predicate<MageObject> {
private final Class<?> abilityClass;
@ -46,7 +46,7 @@ public class AbilityPredicate<T extends MageObject> implements Predicate<T> {
}
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
Abilities<Ability> abilities = input.getAbilities();
for (int i = 0; i < abilities.size(); i++) {
if (abilityClass.equals(abilities.get(i).getClass())) {

View file

@ -36,7 +36,7 @@ import mage.game.Game;
*
* @author North
*/
public class CardTypePredicate<T extends MageObject> implements Predicate<T> {
public class CardTypePredicate implements Predicate<MageObject> {
private final CardType cardType;
@ -45,7 +45,7 @@ public class CardTypePredicate<T extends MageObject> implements Predicate<T> {
}
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
return input.getCardType().contains(cardType);
}

View file

@ -36,7 +36,7 @@ import mage.game.Game;
*
* @author North
*/
public class ColorPredicate<T extends MageObject> implements Predicate<T> {
public class ColorPredicate implements Predicate<MageObject> {
private final ObjectColor color;
@ -45,7 +45,7 @@ public class ColorPredicate<T extends MageObject> implements Predicate<T> {
}
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
return input.getColor().contains(color);
}

View file

@ -35,10 +35,10 @@ import mage.game.Game;
*
* @author North
*/
public class ColorlessPredicate<T extends MageObject> implements Predicate<T> {
public class ColorlessPredicate implements Predicate<MageObject> {
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
return input.getColor().isColorless();
}

View file

@ -35,14 +35,14 @@ import mage.filter.predicate.IntComparePredicate;
*
* @author North
*/
public class ConvertedManaCostPredicate<T extends MageObject> extends IntComparePredicate<T> {
public class ConvertedManaCostPredicate extends IntComparePredicate<MageObject> {
public ConvertedManaCostPredicate(Filter.ComparisonType type, int value) {
super(type, value);
}
@Override
protected int getInputValue(T input) {
protected int getInputValue(MageObject input) {
return input.getManaCost().convertedManaCost();
}

View file

@ -35,7 +35,7 @@ import mage.game.Game;
*
* @author North
*/
public class NamePredicate<T extends MageObject> implements Predicate<T> {
public class NamePredicate implements Predicate<MageObject> {
private final String name;
@ -44,7 +44,7 @@ public class NamePredicate<T extends MageObject> implements Predicate<T> {
}
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
return name.equals(input.getName());
}

View file

@ -35,14 +35,14 @@ import mage.filter.predicate.IntComparePredicate;
*
* @author North
*/
public class PowerPredicate<T extends MageObject> extends IntComparePredicate<T> {
public class PowerPredicate extends IntComparePredicate<MageObject> {
public PowerPredicate(Filter.ComparisonType type, int value) {
super(type, value);
}
@Override
protected int getInputValue(T input) {
protected int getInputValue(MageObject input) {
return input.getPower().getValue();
}

View file

@ -35,7 +35,7 @@ import mage.game.Game;
*
* @author North
*/
public class SubtypePredicate<T extends MageObject> implements Predicate<T> {
public class SubtypePredicate implements Predicate<MageObject> {
private final String subtype;
@ -44,7 +44,7 @@ public class SubtypePredicate<T extends MageObject> implements Predicate<T> {
}
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
return input.getSubtype().contains(subtype);
}

View file

@ -35,7 +35,7 @@ import mage.game.Game;
*
* @author North
*/
public class SupertypePredicate<T extends MageObject> implements Predicate<T> {
public class SupertypePredicate implements Predicate<MageObject> {
private final String supertype;
@ -44,7 +44,7 @@ public class SupertypePredicate<T extends MageObject> implements Predicate<T> {
}
@Override
public boolean apply(T input, Game game) {
public boolean apply(MageObject input, Game game) {
return input.getSupertype().contains(supertype);
}

View file

@ -35,14 +35,14 @@ import mage.filter.predicate.IntComparePredicate;
*
* @author North
*/
public class ToughnessPredicate<T extends MageObject> extends IntComparePredicate<T> {
public class ToughnessPredicate extends IntComparePredicate<MageObject> {
public ToughnessPredicate(Filter.ComparisonType type, int value) {
super(type, value);
}
@Override
protected int getInputValue(T input) {
protected int getInputValue(MageObject input) {
return input.getToughness().getValue();
}