FIX incorporating tokenKey with tokenSection if Any

(tokenSection is null for non-legal-card-type token)

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
This commit is contained in:
leriomaggio
2021-09-15 20:07:47 +01:00
parent 5e1b85c924
commit 02fcc0efb5

View File

@@ -149,12 +149,19 @@ public class DeckRecognizer {
} }
public String getKey(){ public String getKey(){
if (this.isCardToken()) if (this.isCardToken()) {
return String.format("%s-%s-%s-%s-%s", if (this.tokenSection != null)
return String.format("%s-%s-%s-%s-%s",
this.card.getName(), this.card.getEdition(),
this.card.getCollectorNumber(),
this.getType().name().toLowerCase(),
this.tokenSection.name());
return String.format("%s-%s-%s-%s",
this.card.getName(), this.card.getEdition(), this.card.getName(), this.card.getEdition(),
this.card.getCollectorNumber(), this.card.getCollectorNumber(),
this.tokenSection.name(), this.getType().name().toLowerCase()); this.getType().name().toLowerCase());
return ""; }
return null;
} }
public static class TokenKey { public static class TokenKey {
@@ -171,8 +178,11 @@ public class DeckRecognizer {
tokenKey.cardName = keyInfo[0]; tokenKey.cardName = keyInfo[0];
tokenKey.setCode = keyInfo[1]; tokenKey.setCode = keyInfo[1];
tokenKey.collectorNumber = keyInfo[2]; tokenKey.collectorNumber = keyInfo[2];
tokenKey.deckSection = keyInfo[3]; tokenKey.typeName = keyInfo[3];
tokenKey.typeName = keyInfo[4]; if (keyInfo.length > 4)
tokenKey.deckSection = keyInfo[3];
else
tokenKey.deckSection = null;
return tokenKey; return tokenKey;
} }
} }