refactor: fully replace PermanentInListPredicate

with PermanentReferenceInCollectionPredicate

related to #10639, #11471, the existence of this was misleading devs to use it incorrectly
This commit is contained in:
xenohedron 2024-01-31 19:39:27 -05:00
parent c528491544
commit 4dd97b41fc
7 changed files with 30 additions and 59 deletions

View file

@ -1,25 +0,0 @@
package mage.filter.predicate.permanent;
import java.util.List;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author L_J
*/
public class PermanentInListPredicate implements Predicate<Permanent> {
private final List<Permanent> permanents;
public PermanentInListPredicate(List<Permanent> permanents) {
this.permanents = permanents;
}
@Override
public boolean apply(Permanent input, Game game) {
return (permanents.contains(input));
}
}

View file

@ -21,7 +21,9 @@ public class PermanentReferenceInCollectionPredicate implements Predicate<Perman
this.references = references;
}
public PermanentReferenceInCollectionPredicate(Collection<Permanent> permanents, Game game) {
this.references = permanents.stream().map((p) -> new MageObjectReference(p, game))
this.references = permanents
.stream()
.map(p -> new MageObjectReference(p, game))
.collect(Collectors.toSet());
}