diff --git a/src/main/java/forge/gui/deckeditor/FilterCheckBoxes.java b/src/main/java/forge/gui/deckeditor/FilterCheckBoxes.java index 1cc7101107b..6db3fcf144a 100644 --- a/src/main/java/forge/gui/deckeditor/FilterCheckBoxes.java +++ b/src/main/java/forge/gui/deckeditor/FilterCheckBoxes.java @@ -80,7 +80,7 @@ class FilterCheckBoxes { if (red.isSelected()) { colors.add(CardRules.Predicates.Presets.isRed); } if (green.isSelected()) { colors.add(CardRules.Predicates.Presets.isGreen); } if (colorless.isSelected()) { colors.add(CardRules.Predicates.Presets.isColorless); } - Predicate filterByColor = colors.size() == 6 ? Predicate.getTrue(CardRules.class) : Predicate.or(colors); + Predicate filterByColor = colors.size() == 6 ? CardRules.Predicates.Presets.constantTrue : Predicate.or(colors); List> types = new ArrayList>(); if (land.isSelected()) { types.add(CardRules.Predicates.Presets.isLand); } @@ -90,7 +90,7 @@ class FilterCheckBoxes { if (planeswalker.isSelected()) { types.add(CardRules.Predicates.Presets.isPlaneswalker); } if (artifact.isSelected()) { types.add(CardRules.Predicates.Presets.isArtifact); } if (enchantment.isSelected()) { types.add(CardRules.Predicates.Presets.isEnchantment); } - Predicate filterByType = types.size() == 7 ? Predicate.getTrue(CardRules.class) : Predicate.or(types); + Predicate filterByType = types.size() == 7 ? CardRules.Predicates.Presets.constantTrue : Predicate.or(types); return Predicate.brigde(Predicate.and(filterByColor, filterByType), CardPrinted.fnGetRules); } diff --git a/src/main/java/net/slightlymagic/maxmtg/Predicate.java b/src/main/java/net/slightlymagic/maxmtg/Predicate.java index 977b2171b9e..badd3f6b9a7 100644 --- a/src/main/java/net/slightlymagic/maxmtg/Predicate.java +++ b/src/main/java/net/slightlymagic/maxmtg/Predicate.java @@ -205,11 +205,10 @@ public abstract class Predicate { } // Static builder methods - they choose concrete implementation by themselves - public static Predicate brigde(Predicate predicate, Lambda1 fnBridge) { - // TODO Auto-generated method stub + public static Predicate brigde(final Predicate predicate, final Lambda1 fnBridge) { return new Bridge(predicate, fnBridge); } - + public static Predicate not(final Predicate operand1) { return new Not(operand1); } public static Predicate compose(final Predicate operand1, final PredicatesOp operator, final Predicate operand2) @@ -223,11 +222,13 @@ public abstract class Predicate { return new NodeAnd(operand1, operand2); } public static Predicate and(final Iterable> operand) { return new MultiNodeAnd(operand); } - public static Predicate and(final Predicate operand1, final Predicate operand2, Lambda1 bridge) { return new NodeAndBridged(operand1, operand2, bridge); } - - public static Predicate or(final Predicate operand1, final Predicate operand2) { return new NodeOr(operand1, operand2); } + public static Predicate and(final Predicate operand1, final Predicate operand2, final Lambda1 bridge) + { return new NodeAndBridged(operand1, operand2, bridge); } + public static Predicate or(final Predicate operand1, final Predicate operand2) + { return new NodeOr(operand1, operand2); } public static Predicate or(final Iterable> operand) { return new MultiNodeOr(operand); } - public static Predicate or(final Predicate operand1, final Predicate operand2, Lambda1 bridge) { return new NodeOrBridged(operand1, operand2, bridge); } + public static Predicate or(final Predicate operand1, final Predicate operand2, final Lambda1 bridge) + { return new NodeOrBridged(operand1, operand2, bridge); } // Concrete implementations // unary operators @@ -241,6 +242,7 @@ public abstract class Predicate { protected final Lambda1 fnBridge; public Bridge(final Predicate operand, final Lambda1 fnTfromU) { filter = operand; fnBridge = fnTfromU; } @Override public boolean isTrue(final U card) { return filter.isTrue(fnBridge.apply(card)); } + @Override public boolean is1() { return filter.is1(); } } // binary operators protected static class Node extends Predicate {