MCPcopy Create free account
hub / github.com/Card-Forge/forge / loadCard

Method loadCard

forge-core/src/main/java/forge/card/CardDb.java:436–463  ·  view source on GitHub ↗
(String cardName, String setCode, CardRules cr)

Source from the content-addressed store, hash-verified

434 }
435
436 public void loadCard(String cardName, String setCode, CardRules cr) {
437 // @leriomaggio: This method is called when lazy-loading is set
438 // OR if a card is trying to load from an edition its not from
439 //System.out.println("[LOG]: (Lazy) Loading Card: " + cardName);
440 if (cr.hasPlaceholderFaces()) {
441 try {
442 cr.supplyPlaceholderFaces(facesByName);
443 } catch (NoSuchElementException e) {
444 e.printStackTrace();
445 return;
446 }
447 }
448 boolean reIndexNecessary = false;
449 CardEdition ed = editions.get(setCode);
450 if (ed == null || ed.equals(CardEdition.UNKNOWN)) {
451 // look for all possible editions
452 for (CardEdition e : editions) {
453 reIndexNecessary |= addFromSetByName(cardName, e, cr);
454 }
455 } else {
456 reIndexNecessary |= addFromSetByName(cardName, ed, cr);
457 }
458
459 if (reIndexNecessary) {
460 rulesByPrimaryName.putIfAbsent(cardName, cr); //TODO: Cache alt names here too.
461 reIndex();
462 }
463 }
464
465 public void initialize(boolean logMissingPerEdition, boolean logMissingSummary, boolean enableUnknownCards) {
466 Set<String> allMissingCards = new LinkedHashSet<>();

Callers 1

attemptToLoadCardMethod · 0.45

Calls 6

equalsMethod · 0.95
addFromSetByNameMethod · 0.95
reIndexMethod · 0.95
hasPlaceholderFacesMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected