if (cards.isEmpty()) {
sbMessage.append("Could not find card: '").append(lineName).append("' at line ").append(lineCount).append("\n");
} else {
// search the card released last with this name
Date lastReleaseDate = new GregorianCalendar(1900, 1, 1).getTime();
CardInfo lastReleasedCard = null;
for (CardInfo cardinfo: cards) {
ExpansionInfo set = ExpansionRepository.instance.getSetByCode(cardinfo.getSetCode());
if (set != null) {
if (lastReleaseDate == null || set.getReleaseDate().after(lastReleaseDate)) {
lastReleasedCard = cardinfo;
lastReleaseDate = set.getReleaseDate();
}
}
}
if (lastReleasedCard == null) {
lastReleasedCard = cards.get(0);
}
for (int i = 0; i < num; i++) {
if (!sideboard) {
deckList.getCards().add(new DeckCardInfo(lastReleasedCard.getName(),lastReleasedCard.getCardNumber(), lastReleasedCard.getSetCode()));
} else {
deckList.getSideboard().add(new DeckCardInfo(lastReleasedCard.getName(),lastReleasedCard.getCardNumber(), lastReleasedCard.getSetCode()));
}
}
}
} catch (NumberFormatException nfe) {
sbMessage.append("Invalid number: ").append(lineNum).append(" at line ").append(lineCount).append("\n");