From bf29c3d96160eeaa64f60a512a0a9f4d7c85167a Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Wed, 24 Jun 2015 18:58:15 +0200 Subject: Mulling over the generic comparator issue --- .../cardbase/comparators/CardComparators.java | 76 ---------------------- 1 file changed, 76 deletions(-) delete mode 100644 src/eu/equalparts/cardbase/comparators/CardComparators.java (limited to 'src/eu/equalparts/cardbase/comparators') diff --git a/src/eu/equalparts/cardbase/comparators/CardComparators.java b/src/eu/equalparts/cardbase/comparators/CardComparators.java deleted file mode 100644 index 99f7ded..0000000 --- a/src/eu/equalparts/cardbase/comparators/CardComparators.java +++ /dev/null @@ -1,76 +0,0 @@ -package eu.equalparts.cardbase.comparators; - -import java.util.Comparator; - -import eu.equalparts.cardbase.data.Card; - -public final class CardComparators { - - private CardComparators() {} - - public enum Order { - NATURAL, REVERSE; - } - - public static class NameComparator implements Comparator { - - private Order order = Order.NATURAL; - - public NameComparator() {} - - public NameComparator(Order order) { - this.order = order; - } - - @Override - public int compare(Card o1, Card o2) { - if (order == Order.NATURAL) { - return o1.name.compareTo(o2.name); - } else { - return o2.name.compareTo(o1.name); - } - - } - } - - public static class LayoutComparator implements Comparator { - - private Order order = Order.NATURAL; - - public LayoutComparator() {} - - public LayoutComparator(Order order) { - this.order = order; - } - - @Override - public int compare(Card o1, Card o2) { - if (order == Order.NATURAL) { - return o1.layout.compareTo(o2.layout); - } else { - return o2.layout.compareTo(o1.layout); - } - } - } - - public static class ManaCostComparator implements Comparator { - - private Order order = Order.NATURAL; - - public ManaCostComparator() {} - - public ManaCostComparator(Order order) { - this.order = order; - } - - @Override - public int compare(Card o1, Card o2) { - if (order == Order.NATURAL) { - return o1.manaCost.compareTo(o2.manaCost); - } else { - return o2.manaCost.compareTo(o1.manaCost); - } - } - } - -} -- cgit v1.2.3