[refactoring] Moved another field to FilterPermanent

This commit is contained in:
North 2012-07-13 23:08:10 +03:00
parent 13f744f09f
commit 4edee0b2f9
3 changed files with 11 additions and 16 deletions

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>> implements Filter<T> { public class FilterAbility<T extends Ability> extends FilterImpl<T, FilterAbility<T>> {
protected static ListComparer<Outcome> compOutcome = new ListComparer<Outcome>(); protected static ListComparer<Outcome> compOutcome = new ListComparer<Outcome>();

View file

@ -32,16 +32,10 @@ import mage.MageObject;
/** /**
* *
* @author BetaSteward_at_googlemail.com
* @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, T extends FilterObject<E, T>> extends FilterImpl<E, T> {
/**
* Indicates that filter shouldn't match the source.
*/
protected boolean another;
@Override @Override
public FilterObject<E, T> copy() { public FilterObject<E, T> copy() {
return new FilterObject<E, T>(this); return new FilterObject<E, T>(this);
@ -53,14 +47,5 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
public FilterObject(FilterObject filter) { public FilterObject(FilterObject filter) {
super(filter); super(filter);
this.another = filter.another;
}
public boolean isAnother() {
return another;
}
public void setAnother(boolean another) {
this.another = another;
} }
} }

View file

@ -55,6 +55,7 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
protected boolean phasedIn; protected boolean phasedIn;
protected TargetController controller = TargetController.ANY; protected TargetController controller = TargetController.ANY;
protected TargetController owner = TargetController.ANY; protected TargetController owner = TargetController.ANY;
protected boolean another;
public FilterPermanent() { public FilterPermanent() {
super("permanent"); super("permanent");
@ -76,6 +77,7 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
this.phasedIn = filter.phasedIn; this.phasedIn = filter.phasedIn;
this.controller = filter.controller; this.controller = filter.controller;
this.owner = filter.owner; this.owner = filter.owner;
this.another = filter.another;
} }
public FilterPermanent(String name) { public FilterPermanent(String name) {
@ -204,6 +206,14 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
this.owner = owner; this.owner = owner;
} }
public boolean isAnother() {
return another;
}
public void setAnother(boolean another) {
this.another = another;
}
public boolean matchOwner(UUID testOwnerId) { public boolean matchOwner(UUID testOwnerId) {
if (ownerId.size() > 0 && ownerId.contains(testOwnerId) == notOwner) if (ownerId.size() > 0 && ownerId.contains(testOwnerId) == notOwner)
return false; return false;