diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2015-06-03 20:36:07 +0200 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2015-06-03 20:36:07 +0200 |
commit | 98a75846c69f53f17389401096d2a19c697045d3 (patch) | |
tree | 8b9512c9dc66abfa0accec59761f25ed487728d6 /src/eu/equalparts/cardbase/data | |
parent | c072ed0ac345a7e421cb0612048d4cd534bf6e73 (diff) |
Have a working example to parse JSON sets and get cards by number
Diffstat (limited to 'src/eu/equalparts/cardbase/data')
-rw-r--r-- | src/eu/equalparts/cardbase/data/Card.java | 233 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/data/CardBase.java | 23 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/data/CardSet.java | 86 |
3 files changed, 342 insertions, 0 deletions
diff --git a/src/eu/equalparts/cardbase/data/Card.java b/src/eu/equalparts/cardbase/data/Card.java new file mode 100644 index 0000000..d125c54 --- /dev/null +++ b/src/eu/equalparts/cardbase/data/Card.java @@ -0,0 +1,233 @@ +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; + + // Not part of JSON, will be set later + private String setCode; + private 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 new file mode 100644 index 0000000..14c30a5 --- /dev/null +++ b/src/eu/equalparts/cardbase/data/CardBase.java @@ -0,0 +1,23 @@ +package eu.equalparts.cardbase.data; +import java.io.File; + +public class CardBase { + + public static void main(String... args) { + + } + + /** + * 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/CardSet.java b/src/eu/equalparts/cardbase/data/CardSet.java new file mode 100644 index 0000000..97622db --- /dev/null +++ b/src/eu/equalparts/cardbase/data/CardSet.java @@ -0,0 +1,86 @@ +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 Card getCardByNumber(String number) { + for (Card card : cards) { + if (card.getNumber().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 |