(boolean logMissingPerEdition, boolean logMissingSummary, boolean enableUnknownCards)
| 463 | } |
| 464 | |
| 465 | public void initialize(boolean logMissingPerEdition, boolean logMissingSummary, boolean enableUnknownCards) { |
| 466 | Set<String> allMissingCards = new LinkedHashSet<>(); |
| 467 | List<String> missingCards = new ArrayList<>(); |
| 468 | CardEdition upcomingSet = null; |
| 469 | Date today = new Date(); |
| 470 | |
| 471 | for (CardEdition e : editions.getOrderedEditions()) { |
| 472 | boolean coreOrExpSet = e.getType() == CardEdition.Type.CORE || e.getType() == CardEdition.Type.EXPANSION; |
| 473 | boolean isCoreExpSet = coreOrExpSet || e.getType() == CardEdition.Type.REPRINT; |
| 474 | if (logMissingPerEdition && isCoreExpSet) { |
| 475 | System.out.print(e.getName() + " (" + e.getAllCardsInSet().size() + " cards)"); |
| 476 | } |
| 477 | if (coreOrExpSet && e.getDate().after(today) && upcomingSet == null) { |
| 478 | upcomingSet = e; |
| 479 | } |
| 480 | |
| 481 | for (CardEdition.EditionEntry cis : e.getAllCardsInSet()) { |
| 482 | CardRules cr = rulesByPrimaryName.get(cis.name()); |
| 483 | if (cr == null) |
| 484 | cr = rulesByAltName.get(cis.name()); //Entry written using a flavor name |
| 485 | if (cr == null) { |
| 486 | missingCards.add(cis.name()); |
| 487 | continue; |
| 488 | } |
| 489 | if (cr.hasFunctionalVariants()) { |
| 490 | if (StringUtils.isNotEmpty(cis.getFunctionalVariantName()) |
| 491 | && !cr.getSupportedFunctionalVariants().contains(cis.getFunctionalVariantName())) { |
| 492 | //Supported card, unsupported variant. |
| 493 | //Could note the card as missing but since these are often un-cards, |
| 494 | //it's likely absent because it does something out of scope. |
| 495 | continue; |
| 496 | } |
| 497 | } |
| 498 | addSetCard(e, cis, cr); |
| 499 | } |
| 500 | if (isCoreExpSet && logMissingPerEdition) { |
| 501 | if (missingCards.isEmpty()) { |
| 502 | System.out.println(" ... 100% "); |
| 503 | } else { |
| 504 | int missing = (e.getAllCardsInSet().size() - missingCards.size()) * 10000 / e.getAllCardsInSet().size(); |
| 505 | System.out.printf(" ... %.2f%% (%s missing: %s)%n", missing * 0.01f, Lang.nounWithAmount(missingCards.size(), "card"), StringUtils.join(missingCards, " | ")); |
| 506 | } |
| 507 | } |
| 508 | if (isCoreExpSet && logMissingSummary) { |
| 509 | allMissingCards.addAll(missingCards); |
| 510 | } |
| 511 | missingCards.clear(); |
| 512 | artIds.clear(); |
| 513 | } |
| 514 | |
| 515 | if (logMissingSummary) { |
| 516 | System.out.printf("Totally %d cards not implemented: %s\n", allMissingCards.size(), StringUtils.join(allMissingCards, " | ")); |
| 517 | } |
| 518 | |
| 519 | if (upcomingSet != null) { |
| 520 | System.err.println("Upcoming set " + upcomingSet + " dated in the future. All `upcoming` cards will be added to this set with unknown rarity."); |
| 521 | } |
| 522 |
nothing calls this directly
no test coverage detected