aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/equalparts/cardbase/data')
-rw-r--r--src/eu/equalparts/cardbase/data/Card.java250
-rw-r--r--src/eu/equalparts/cardbase/data/CardBase.java23
-rw-r--r--src/eu/equalparts/cardbase/data/CardBaseManager.java43
-rw-r--r--src/eu/equalparts/cardbase/data/CardSet.java90
-rw-r--r--src/eu/equalparts/cardbase/data/Deck.java5
-rw-r--r--src/eu/equalparts/cardbase/data/MetaCardSet.java39
6 files changed, 135 insertions, 315 deletions
diff --git a/src/eu/equalparts/cardbase/data/Card.java b/src/eu/equalparts/cardbase/data/Card.java
index d125c54..8e25d56 100644
--- a/src/eu/equalparts/cardbase/data/Card.java
+++ b/src/eu/equalparts/cardbase/data/Card.java
@@ -3,231 +3,33 @@ package eu.equalparts.cardbase.data;
import java.util.ArrayList;
public class Card {
- private String layout;
- private String name;
- private ArrayList<String> names;
- private String manaCost;
- private Integer cmc;
- private ArrayList<String> colors;
- private String type;
- private ArrayList<String> supertypes;
- private ArrayList<String> types;
- private ArrayList<String> subtypes;
- private String rarity;
- private String text;
- private String flavor;
- private String artist;
- private String number;
- private String power;
- private String toughness;
- private Integer loyalty;
- private Integer multiverseid;
- private ArrayList<String> variations;
- private String imageName;
- private String border;
- private String watermark;
+
+ public String layout;
+ public String name;
+ public ArrayList<String> names;
+ public String manaCost;
+ public Integer cmc;
+ public ArrayList<String> colors;
+ public String type;
+ public ArrayList<String> supertypes;
+ public ArrayList<String> types;
+ public ArrayList<String> subtypes;
+ public String rarity;
+ public String text;
+ public String flavor;
+ public String artist;
+ public String number;
+ public String power;
+ public String toughness;
+ public Integer loyalty;
+ public Integer multiverseid;
+ public ArrayList<String> variations;
+ public String imageName;
+ public String border;
+ public String watermark;
// Not part of JSON, will be set later
- private String setCode;
- private String setName;
+ public String setCode;
+ public String setName;
- public String getLayout() {
- return layout;
- }
-
- public void setLayout(String layout) {
- this.layout = layout;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public ArrayList<String> getNames() {
- return names;
- }
-
- public void setNames(ArrayList<String> names) {
- this.names = names;
- }
-
- public String getManaCost() {
- return manaCost;
- }
-
- public void setManaCost(String manaCost) {
- this.manaCost = manaCost;
- }
-
- public Integer getCmc() {
- return cmc;
- }
-
- public void setCmc(Integer cmc) {
- this.cmc = cmc;
- }
-
- public ArrayList<String> getColors() {
- return colors;
- }
-
- public void setColors(ArrayList<String> colors) {
- this.colors = colors;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public ArrayList<String> getSupertypes() {
- return supertypes;
- }
-
- public void setSupertypes(ArrayList<String> supertypes) {
- this.supertypes = supertypes;
- }
-
- public ArrayList<String> getTypes() {
- return types;
- }
-
- public void setTypes(ArrayList<String> types) {
- this.types = types;
- }
-
- public ArrayList<String> getSubtypes() {
- return subtypes;
- }
-
- public void setSubtypes(ArrayList<String> subtypes) {
- this.subtypes = subtypes;
- }
-
- public String getRarity() {
- return rarity;
- }
-
- public void setRarity(String rarity) {
- this.rarity = rarity;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public String getFlavor() {
- return flavor;
- }
-
- public void setFlavor(String flavor) {
- this.flavor = flavor;
- }
-
- public String getArtist() {
- return artist;
- }
-
- public void setArtist(String artist) {
- this.artist = artist;
- }
-
- public String getNumber() {
- return number;
- }
-
- public void setNumber(String number) {
- this.number = number;
- }
-
- public String getPower() {
- return power;
- }
-
- public void setPower(String power) {
- this.power = power;
- }
-
- public String getToughness() {
- return toughness;
- }
-
- public void setToughness(String toughness) {
- this.toughness = toughness;
- }
-
- public Integer getLoyalty() {
- return loyalty;
- }
-
- public void setLoyalty(Integer loyalty) {
- this.loyalty = loyalty;
- }
-
- public Integer getMultiverseid() {
- return multiverseid;
- }
-
- public void setMultiverseid(Integer multiverseid) {
- this.multiverseid = multiverseid;
- }
-
- public ArrayList<String> getVariations() {
- return variations;
- }
-
- public void setVariations(ArrayList<String> variations) {
- this.variations = variations;
- }
-
- public String getImageName() {
- return imageName;
- }
-
- public void setImageName(String imageName) {
- this.imageName = imageName;
- }
-
- public String getBorder() {
- return border;
- }
-
- public void setBorder(String border) {
- this.border = border;
- }
-
- public String getWatermark() {
- return watermark;
- }
-
- public void setWatermark(String watermark) {
- this.watermark = watermark;
- }
-
- public String getSetName() {
- return setName;
- }
-
- public void setSetName(String setName) {
- this.setName = setName;
- }
-
- public String getSetCode() {
- return setCode;
- }
-
- public void setSetCode(String setCode) {
- this.setCode = setCode;
- }
} \ No newline at end of file
diff --git a/src/eu/equalparts/cardbase/data/CardBase.java b/src/eu/equalparts/cardbase/data/CardBase.java
index 14c30a5..70ae0ea 100644
--- a/src/eu/equalparts/cardbase/data/CardBase.java
+++ b/src/eu/equalparts/cardbase/data/CardBase.java
@@ -1,23 +1,12 @@
package eu.equalparts.cardbase.data;
-import java.io.File;
+
+import java.util.ArrayList;
public class CardBase {
- public static void main(String... args) {
-
- }
+ private ArrayList<Card> cards;
+ private ArrayList<Deck> decks;
+
+
- /**
- * Parse a cardbase file and create an associated CardBase object.
- */
- public CardBase(File cardbase) {
-
- }
-
- /**
- * Create an empty CardBase.
- */
- public CardBase() {
-
- }
}
diff --git a/src/eu/equalparts/cardbase/data/CardBaseManager.java b/src/eu/equalparts/cardbase/data/CardBaseManager.java
new file mode 100644
index 0000000..acf5a3a
--- /dev/null
+++ b/src/eu/equalparts/cardbase/data/CardBaseManager.java
@@ -0,0 +1,43 @@
+package eu.equalparts.cardbase.data;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+import eu.equalparts.cardbase.query.IO;
+
+public class CardBaseManager {
+
+ private ArrayList<MetaCardSet> metaSets;
+
+ public static void main(String... args) {
+
+ }
+
+ /**
+ * Parse a cardbase file and create an associated CardBase object.
+ * @throws IOException
+ * @throws JsonMappingException
+ * @throws JsonParseException
+ */
+ public CardBaseManager(File cardbase) throws JsonParseException, JsonMappingException, IOException {
+ metaSets = IO.getAllMetaSets();
+ }
+
+ /**
+ * Create an empty CardBase.
+ * @throws IOException
+ * @throws JsonMappingException
+ * @throws JsonParseException
+ */
+ public CardBaseManager() throws JsonParseException, JsonMappingException, IOException {
+ metaSets = IO.getAllMetaSets();
+ }
+
+ public ArrayList<MetaCardSet> getAllMetaSets() {
+ return metaSets;
+ }
+
+}
diff --git a/src/eu/equalparts/cardbase/data/CardSet.java b/src/eu/equalparts/cardbase/data/CardSet.java
index 97622db..2c8f950 100644
--- a/src/eu/equalparts/cardbase/data/CardSet.java
+++ b/src/eu/equalparts/cardbase/data/CardSet.java
@@ -3,84 +3,26 @@ package eu.equalparts.cardbase.data;
import java.util.ArrayList;
public class CardSet {
- private String name;
- private String code;
- private String releaseDate;
- private String border;
- private String type;
- private String block;
- private String gathererCode;
- private ArrayList<Card> cards;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getReleaseDate() {
- return releaseDate;
- }
-
- public void setReleaseDate(String releaseDate) {
- this.releaseDate = releaseDate;
- }
-
- public String getBorder() {
- return border;
- }
-
- public void setBorder(String border) {
- this.border = border;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getBlock() {
- return block;
- }
-
- public void setBlock(String block) {
- this.block = block;
- }
-
- public ArrayList<Card> getCards() {
- return cards;
- }
-
+ public String name;
+ public String code;
+ public String releaseDate;
+ public String border;
+ public String type;
+ public String block;
+ public String gathererCode;
+ public ArrayList<Card> cards;
+
+ /**
+ * Searches for a card by number (the one shown on the card itself).
+ *
+ * @param number the number of the card to search.
+ * @return the card, or null if no card is found with that number.
+ */
public Card getCardByNumber(String number) {
for (Card card : cards) {
- if (card.getNumber().equals(number))
+ if (card.number.equals(number))
return card;
}
return null;
}
-
- public void setCards(ArrayList<Card> cards) {
- this.cards = cards;
- }
-
- public String getGathererCode() {
- return gathererCode;
- }
-
- public void setGathererCode(String gathererCode) {
- this.gathererCode = gathererCode;
- }
} \ No newline at end of file
diff --git a/src/eu/equalparts/cardbase/data/Deck.java b/src/eu/equalparts/cardbase/data/Deck.java
new file mode 100644
index 0000000..50f1129
--- /dev/null
+++ b/src/eu/equalparts/cardbase/data/Deck.java
@@ -0,0 +1,5 @@
+package eu.equalparts.cardbase.data;
+
+public class Deck {
+
+}
diff --git a/src/eu/equalparts/cardbase/data/MetaCardSet.java b/src/eu/equalparts/cardbase/data/MetaCardSet.java
new file mode 100644
index 0000000..4ddf228
--- /dev/null
+++ b/src/eu/equalparts/cardbase/data/MetaCardSet.java
@@ -0,0 +1,39 @@
+package eu.equalparts.cardbase.data;
+
+public class MetaCardSet {
+
+ private String name = "";
+ private String code = "";
+ private String releaseDate = "";
+
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getReleaseDate() {
+ return releaseDate;
+ }
+
+ public void setReleaseDate(String releaseDate) {
+ this.releaseDate = releaseDate;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%1$-12s : %2$s", code, name, releaseDate);
+ }
+
+}