{@inheritDoc}
(final Object o)
| 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; |
no test coverage detected