aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/cards
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2016-08-11 23:59:10 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2016-08-11 23:59:10 +0200
commitc07d860f1d90dc3961b31c87dbe637dbcd87da76 (patch)
treee31997581287fd5d021aebc60ea7c5ad08539bbc /src/eu/equalparts/cardbase/cards
parentf7fe057b745d3f0e19b5dd6bd1819b11fc89c551 (diff)
Refactored the Card data structure to be able to do filtering properly
Diffstat (limited to 'src/eu/equalparts/cardbase/cards')
-rw-r--r--src/eu/equalparts/cardbase/cards/Card.java96
-rw-r--r--src/eu/equalparts/cardbase/cards/CardSetInformation.java34
-rw-r--r--src/eu/equalparts/cardbase/cards/FullCardSet.java26
-rw-r--r--src/eu/equalparts/cardbase/cards/OldCard.java95
4 files changed, 0 insertions, 251 deletions
diff --git a/src/eu/equalparts/cardbase/cards/Card.java b/src/eu/equalparts/cardbase/cards/Card.java
deleted file mode 100644
index 37cc13e..0000000
--- a/src/eu/equalparts/cardbase/cards/Card.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package eu.equalparts.cardbase.cards;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-
-import eu.equalparts.cardbase.comparator.SpecialFields.DirtyNumber;
-import eu.equalparts.cardbase.comparator.SpecialFields.Rarity;
-
-@JsonAutoDetect
-public class Card {
-
- public String name;
- public String layout;
- public String manaCost;
- public Integer cmc;
- public String type;
- @Rarity
- public String rarity;
- public String text;
- public String flavor;
- public String artist;
- @DirtyNumber
- public String number;
- @DirtyNumber
- public String power;
- @DirtyNumber
- public String toughness;
- public Integer loyalty;
- public Integer multiverseid;
- public String imageName;
- public String watermark;
-
- // Not part of upstream JSON
- public String setCode;
- public String imageCode;
-
- @Override
- public Card clone() {
- Card clone = new Card();
-
- clone.name = this.name;
- clone.layout = this.layout;
- clone.manaCost = this.manaCost;
- clone.cmc = this.cmc;
- clone.type = this.type;
- clone.rarity = this.rarity;
- clone.text = this.text;
- clone.flavor = this.flavor;
- clone.artist = this.artist;
- clone.number = this.number;
- clone.power = this.power;
- clone.toughness = this.toughness;
- clone.loyalty = this.loyalty;
- clone.multiverseid = this.multiverseid;
- clone.imageName = this.imageName;
- clone.watermark = this.watermark;
- clone.setCode = this.setCode;
- clone.imageCode = this.imageCode;
-
- return clone;
- }
-
- public static int makeHash(String setCode, String number) {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((number == null) ? 0 : number.hashCode());
- result = prime * result + ((setCode == null) ? 0 : setCode.hashCode());
- return result;
- }
-
- @Override
- public int hashCode() {
- return makeHash(setCode, number);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Card other = (Card) obj;
- if (number == null) {
- if (other.number != null)
- return false;
- } else if (!number.equals(other.number))
- return false;
- if (setCode == null) {
- if (other.setCode != null)
- return false;
- } else if (!setCode.equals(other.setCode))
- return false;
- return true;
- }
-} \ No newline at end of file
diff --git a/src/eu/equalparts/cardbase/cards/CardSetInformation.java b/src/eu/equalparts/cardbase/cards/CardSetInformation.java
deleted file mode 100644
index 587c99a..0000000
--- a/src/eu/equalparts/cardbase/cards/CardSetInformation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package eu.equalparts.cardbase.cards;
-
-public class CardSetInformation {
-
- private String name;
- private String code;
- private String releaseDate;
-
- /**
- * @return the set's name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return the set code.
- */
- public String getCode() {
- return code;
- }
-
- /**
- * @return the set's release date.
- */
- public String getReleaseDate() {
- return releaseDate;
- }
-
- @Override
- public String toString() {
- return String.format("%1$-12s : %2$s", code, name, releaseDate);
- }
-}
diff --git a/src/eu/equalparts/cardbase/cards/FullCardSet.java b/src/eu/equalparts/cardbase/cards/FullCardSet.java
deleted file mode 100644
index d627111..0000000
--- a/src/eu/equalparts/cardbase/cards/FullCardSet.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package eu.equalparts.cardbase.cards;
-
-import java.util.Map;
-
-public class FullCardSet {
-
- public String name;
- public String code;
- public String magicCardsInfoCode;
- public String releaseDate;
- public String border;
- public String type;
- public String block;
- public String gathererCode;
- public Map<String, 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 requested {@code Card}, or null if no card is found with that number.
- */
- public Card getCardByNumber(String number) {
- return cards.get(number);
- }
-} \ No newline at end of file
diff --git a/src/eu/equalparts/cardbase/cards/OldCard.java b/src/eu/equalparts/cardbase/cards/OldCard.java
deleted file mode 100644
index daa831e..0000000
--- a/src/eu/equalparts/cardbase/cards/OldCard.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package eu.equalparts.cardbase.cards;
-
-import eu.equalparts.cardbase.comparator.SpecialFields.DirtyNumber;
-import eu.equalparts.cardbase.comparator.SpecialFields.Rarity;
-
-public class OldCard {
-
- public String name;
- public String layout;
- public String manaCost;
- public Integer cmc;
- public String type;
- @Rarity
- public String rarity;
- public String text;
- public String flavor;
- public String artist;
- @DirtyNumber
- public String number;
- @DirtyNumber
- public String power;
- @DirtyNumber
- public String toughness;
- public Integer loyalty;
- public Integer multiverseid;
- public String imageName;
- public String watermark;
-
- // Not part of upstream JSON
- public String setCode;
- public String imageCode;
- public Integer count;
-
- @Override
- public OldCard clone() {
- OldCard clone = new OldCard();
-
- clone.name = this.name;
- clone.layout = this.layout;
- clone.manaCost = this.manaCost;
- clone.cmc = this.cmc;
- clone.type = this.type;
- clone.rarity = this.rarity;
- clone.text = this.text;
- clone.flavor = this.flavor;
- clone.artist = this.artist;
- clone.number = this.number;
- clone.power = this.power;
- clone.toughness = this.toughness;
- clone.loyalty = this.loyalty;
- clone.multiverseid = this.multiverseid;
- clone.imageName = this.imageName;
- clone.watermark = this.watermark;
- clone.setCode = this.setCode;
- clone.imageCode = this.imageCode;
- clone.count = this.count;
-
- return clone;
- }
-
- public static int makeHash(String setCode, String number) {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((number == null) ? 0 : number.hashCode());
- result = prime * result + ((setCode == null) ? 0 : setCode.hashCode());
- return result;
- }
-
- @Override
- public int hashCode() {
- return makeHash(setCode, number);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- OldCard other = (OldCard) obj;
- if (number == null) {
- if (other.number != null)
- return false;
- } else if (!number.equals(other.number))
- return false;
- if (setCode == null) {
- if (other.setCode != null)
- return false;
- } else if (!setCode.equals(other.setCode))
- return false;
- return true;
- }
-} \ No newline at end of file