From a0930e33796444a26e7864ca1c1c8376036789d5 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Fri, 3 Mar 2017 22:14:00 +0100 Subject: [PATCH] missed 2 hashsets to enumsets --- .../client/dialog/CardInfoWindowDialog.java | 46 ++++++++++--------- Mage.Common/src/mage/view/AbilityView.java | 12 ++--- Mage.Common/src/mage/view/CardView.java | 4 +- .../src/mage/cards/p/PossibilityStorm.java | 3 +- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index 131e1f69762..801cbc5c794 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -44,6 +44,7 @@ import javax.swing.ImageIcon; import javax.swing.SwingUtilities; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; + import mage.client.cards.BigCard; import mage.client.util.GUISizeHelper; import mage.client.util.ImageHelper; @@ -58,7 +59,6 @@ import org.apache.log4j.Logger; import org.mage.plugins.card.utils.impl.ImageManagerImpl; /** - * * @author BetaSteward_at_googlemail.com */ public class CardInfoWindowDialog extends MageDialog { @@ -109,7 +109,7 @@ public class CardInfoWindowDialog extends MageDialog { this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage())); break; default: - // no icon yet + // no icon yet } this.setTitelBarToolTip(name); setGUISize(); @@ -202,17 +202,19 @@ public class CardInfoWindowDialog extends MageDialog { }); } - private int qtyCardTypes(mage.view.CardsView cardsView){ - Set cardTypesPresent = new LinkedHashSet() {}; - for (CardView card : cardsView.values()){ + private int qtyCardTypes(mage.view.CardsView cardsView) { + Set cardTypesPresent = new LinkedHashSet() { + }; + for (CardView card : cardsView.values()) { Set cardTypes = card.getCardTypes(); - for (CardType cardType : cardTypes){ + for (CardType cardType : cardTypes) { cardTypesPresent.add(cardType.toString()); } } if (cardTypesPresent.isEmpty()) return 0; else return cardTypesPresent.size(); } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -227,24 +229,24 @@ public class CardInfoWindowDialog extends MageDialog { setIconifiable(true); setResizable(true); setPreferredSize(new Dimension((int) Math.round(GUISizeHelper.otherZonesCardDimension.width * 1.3), - (int) Math.round(GUISizeHelper.otherZonesCardDimension.height * 1.2))); + (int) Math.round(GUISizeHelper.otherZonesCardDimension.height * 1.2))); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(0, 0, 0)) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(0, 0, 0)) - ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(0, 0, 0)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(0, 0, 0)) + ); - pack(); + pack(); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/Mage.Common/src/mage/view/AbilityView.java b/Mage.Common/src/mage/view/AbilityView.java index 69ff1a57971..2c6b61bfe83 100644 --- a/Mage.Common/src/mage/view/AbilityView.java +++ b/Mage.Common/src/mage/view/AbilityView.java @@ -28,14 +28,14 @@ package mage.view; -import java.util.ArrayList; -import java.util.HashSet; - import mage.ObjectColor; import mage.abilities.Ability; +import mage.constants.CardType; + +import java.util.ArrayList; +import java.util.EnumSet; /** - * * @author BetaSteward_at_googlemail.com */ public class AbilityView extends CardView { @@ -55,7 +55,7 @@ public class AbilityView extends CardView { this.power = ""; this.toughness = ""; this.loyalty = ""; - this.cardTypes = new HashSet<>(); + this.cardTypes = EnumSet.noneOf(CardType.class); this.subTypes = new ArrayList<>(); this.superTypes = new ArrayList<>(); this.color = new ObjectColor(); @@ -69,6 +69,6 @@ public class AbilityView extends CardView { public void setName(String name) { this.name = name; } - + } diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 000e6eb91d5..82d6c397c55 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -70,7 +70,7 @@ public class CardView extends SimpleCardView { protected String toughness; protected String loyalty; protected String startingLoyalty; - protected Set cardTypes; + protected EnumSet cardTypes; protected List subTypes; protected List superTypes; protected ObjectColor color; @@ -518,7 +518,7 @@ public class CardView extends SimpleCardView { this.toughness = ""; this.loyalty = ""; this.startingLoyalty = ""; - this.cardTypes = new HashSet<>(); + this.cardTypes = EnumSet.noneOf(CardType.class); this.subTypes = new ArrayList<>(); this.superTypes = new ArrayList<>(); this.color = new ObjectColor(); diff --git a/Mage.Sets/src/mage/cards/p/PossibilityStorm.java b/Mage.Sets/src/mage/cards/p/PossibilityStorm.java index 750ddee03cd..c5d41a92fcd 100644 --- a/Mage.Sets/src/mage/cards/p/PossibilityStorm.java +++ b/Mage.Sets/src/mage/cards/p/PossibilityStorm.java @@ -27,6 +27,7 @@ */ package mage.cards.p; +import java.util.EnumSet; import java.util.List; import java.util.Set; import java.util.UUID; @@ -165,7 +166,7 @@ class PossibilityStormEffect extends OneShotEffect { return false; } - private boolean sharesType(Card card, Set cardTypes) { + private boolean sharesType(Card card, EnumSet cardTypes) { for (CardType type : card.getCardType()) { if (cardTypes.contains(type)) { return true;