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

Method equals

forge-core/src/main/java/forge/deck/Deck.java:732–756  ·  view source on GitHub ↗

{@inheritDoc}

(final Object o)

Source from the content-addressed store, hash-verified

730
731 /** {@inheritDoc} */
732 @Override
733 public boolean equals(final Object o) {
734 if (o instanceof DeckBase deckBase) {
735 boolean deckBaseEquals = super.equals(deckBase);
736 if (!deckBaseEquals)
737 return false;
738 // ok so far we made sure they do have the same name. Now onto comparing parts
739 final Deck d = (Deck) o;
740 for (DeckSection deckSection : this.parts.keySet()) {
741 CardPool otherPool = d.get(deckSection);
742 CardPool thisPool = this.parts.get(deckSection);
743 if (!thisPool.equals(otherPool)) // this also accounts for null from d.get
744 return false;
745 }
746 // if we reached this far, it means all sections in this.parts are identical to d.parts
747 // now let's consider the other way around, as in any section in d not in parts.
748 for (DeckSection deckSection: d.parts.keySet()){
749 CardPool otherPool = d.get(deckSection);
750 if (!this.parts.containsKey(deckSection) && otherPool.countAll() > 0)
751 return false;
752 }
753 return true;
754 }
755 return false;
756 }
757
758 public int getAverageCMC() {
759 int totalCMC = 0;

Callers 15

EditorMainWindowMethod · 0.45
QuestStageEditClass · 0.45
refreshMethod · 0.45
setSpritePathMethod · 0.45
loadNewNodeSelectionMethod · 0.45
initializeFormatMethod · 0.45
getCardEditionMethod · 0.45
getCardFromSetMethod · 0.45
auditMethod · 0.45
getImageFileMethod · 0.45
findFileMethod · 0.45
addTokenInSetMethod · 0.45

Calls 4

getMethod · 0.95
containsKeyMethod · 0.80
countAllMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected