aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eu/equalparts/cardbase/Cardbase.java7
-rw-r--r--src/eu/equalparts/cardbase/cards/Card.java1
-rw-r--r--src/eu/equalparts/cardbase/decks/StandaloneDeck.java7
3 files changed, 8 insertions, 7 deletions
diff --git a/src/eu/equalparts/cardbase/Cardbase.java b/src/eu/equalparts/cardbase/Cardbase.java
index 3704d3f..ee49db1 100644
--- a/src/eu/equalparts/cardbase/Cardbase.java
+++ b/src/eu/equalparts/cardbase/Cardbase.java
@@ -2,6 +2,7 @@ package eu.equalparts.cardbase;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -188,13 +189,13 @@ public class Cardbase {
}
/**
- * @param field the name of the field by which to sort.
+ * @param fieldName the name of the field by which to sort.
* @return an unmodifiable collection representing the cardbase sorted in the required order.
* @throws NoSuchFieldException if the field provided is invalid.
*/
- public Collection<Card> sort(String field) throws NoSuchFieldException {
+ public Collection<Card> sortByField(String fieldName) throws NoSuchFieldException {
List<Card> sortedCards = new ArrayList<Card>(dataContainer.cards.values());
- sortedCards.sort(new CardComparator(Card.class.getDeclaredField(field)));
+ sortedCards.sort(new CardComparator(Card.class.getDeclaredField(fieldName)));
return Collections.unmodifiableCollection(sortedCards);
}
diff --git a/src/eu/equalparts/cardbase/cards/Card.java b/src/eu/equalparts/cardbase/cards/Card.java
index 901a566..9b0975b 100644
--- a/src/eu/equalparts/cardbase/cards/Card.java
+++ b/src/eu/equalparts/cardbase/cards/Card.java
@@ -29,7 +29,6 @@ public class Card {
// Not part of upstream JSON
public String setCode;
public String imageCode;
- //public Integer count;
@Override
public Card clone() {
diff --git a/src/eu/equalparts/cardbase/decks/StandaloneDeck.java b/src/eu/equalparts/cardbase/decks/StandaloneDeck.java
index 4c6d25c..f015a91 100644
--- a/src/eu/equalparts/cardbase/decks/StandaloneDeck.java
+++ b/src/eu/equalparts/cardbase/decks/StandaloneDeck.java
@@ -1,12 +1,13 @@
package eu.equalparts.cardbase.decks;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.HashMap;
+import java.util.Map;
import eu.equalparts.cardbase.cards.Card;
public class StandaloneDeck extends Deck {
- public Set<Card> cards = new HashSet<Card>();
+ private Map<Integer, Card> cards = new HashMap<Integer, Card>();
+ private Map<Integer, Integer> counts = new HashMap<Integer, Integer>();
}