From d05ecdf8402c3f7ad072a5e0f2d4ea86d4518869 Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Sun, 2 Feb 2014 01:40:32 +0000 Subject: [PATCH] propper filtering of deck proxies --- .../itemmanager/filters/DeckColorFilter.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/forge-gui/src/main/java/forge/gui/toolbox/itemmanager/filters/DeckColorFilter.java b/forge-gui/src/main/java/forge/gui/toolbox/itemmanager/filters/DeckColorFilter.java index fa55d067368..51ed2f9b7c4 100644 --- a/forge-gui/src/main/java/forge/gui/toolbox/itemmanager/filters/DeckColorFilter.java +++ b/forge-gui/src/main/java/forge/gui/toolbox/itemmanager/filters/DeckColorFilter.java @@ -77,45 +77,45 @@ public class DeckColorFilter extends StatTypeFilter { }; } - private static final Predicate IS_WHITE = new Predicate() { + private static final Predicate IS_WHITE = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return deck.getColor().hasAnyColor(MagicColor.WHITE); } }; - private static final Predicate IS_BLUE = new Predicate() { + private static final Predicate IS_BLUE = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return deck.getColor().hasAnyColor(MagicColor.BLUE); } }; - public static final Predicate IS_BLACK = new Predicate() { + public static final Predicate IS_BLACK = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return deck.getColor().hasAnyColor(MagicColor.BLACK); } }; - public static final Predicate IS_RED = new Predicate() { + public static final Predicate IS_RED = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return deck.getColor().hasAnyColor(MagicColor.RED); } }; - public static final Predicate IS_GREEN = new Predicate() { + public static final Predicate IS_GREEN = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return deck.getColor().hasAnyColor(MagicColor.GREEN); } }; - private static final Predicate IS_COLORLESS = new Predicate() { + private static final Predicate IS_COLORLESS = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return deck.getColor().getColor() == 0; } }; - private static final Predicate IS_MULTICOLOR = new Predicate() { + private static final Predicate IS_MULTICOLOR = new Predicate() { @Override - public boolean apply(final Deck deck) { + public boolean apply(final DeckProxy deck) { return BinaryUtil.bitCount(deck.getColor().getColor()) > 1; } }; @@ -124,13 +124,13 @@ public class DeckColorFilter extends StatTypeFilter { public void afterFiltersApplied() { final ItemPool items = itemManager.getFilteredItems(); - buttonMap.get(StatTypes.DECK_WHITE).setText(String.valueOf(items.countAll(IS_WHITE, Deck.class))); - buttonMap.get(StatTypes.DECK_BLUE).setText(String.valueOf(items.countAll(IS_BLUE, Deck.class))); - buttonMap.get(StatTypes.DECK_BLACK).setText(String.valueOf(items.countAll(IS_BLACK, Deck.class))); - buttonMap.get(StatTypes.DECK_RED).setText(String.valueOf(items.countAll(IS_RED, Deck.class))); - buttonMap.get(StatTypes.DECK_GREEN).setText(String.valueOf(items.countAll(IS_GREEN, Deck.class))); - buttonMap.get(StatTypes.DECK_COLORLESS).setText(String.valueOf(items.countAll(IS_COLORLESS, Deck.class))); - buttonMap.get(StatTypes.DECK_MULTICOLOR).setText(String.valueOf(items.countAll(IS_MULTICOLOR, Deck.class))); + buttonMap.get(StatTypes.DECK_WHITE).setText(String.valueOf(items.countAll(IS_WHITE, DeckProxy.class))); + buttonMap.get(StatTypes.DECK_BLUE).setText(String.valueOf(items.countAll(IS_BLUE, DeckProxy.class))); + buttonMap.get(StatTypes.DECK_BLACK).setText(String.valueOf(items.countAll(IS_BLACK, DeckProxy.class))); + buttonMap.get(StatTypes.DECK_RED).setText(String.valueOf(items.countAll(IS_RED, DeckProxy.class))); + buttonMap.get(StatTypes.DECK_GREEN).setText(String.valueOf(items.countAll(IS_GREEN, DeckProxy.class))); + buttonMap.get(StatTypes.DECK_COLORLESS).setText(String.valueOf(items.countAll(IS_COLORLESS, DeckProxy.class))); + buttonMap.get(StatTypes.DECK_MULTICOLOR).setText(String.valueOf(items.countAll(IS_MULTICOLOR, DeckProxy.class))); getWidget().revalidate(); }