aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/comparators
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2015-06-24 18:58:15 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2015-06-24 18:58:15 +0200
commitbf29c3d96160eeaa64f60a512a0a9f4d7c85167a (patch)
treed748a0fa4016c188b3d4be5bdd719261b40655b0 /src/eu/equalparts/cardbase/comparators
parent59174889aba82c64ae63e0a5622d6cbcab63dc39 (diff)
Mulling over the generic comparator issue
Diffstat (limited to 'src/eu/equalparts/cardbase/comparators')
-rw-r--r--src/eu/equalparts/cardbase/comparators/CardComparators.java76
1 files changed, 0 insertions, 76 deletions
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<Card> {
-
- 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<Card> {
-
- 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<Card> {
-
- 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);
- }
- }
- }
-
-}