missed 2 hashsets to enumsets

This commit is contained in:
ingmargoudt 2017-03-03 22:14:00 +01:00
parent 372584f7ad
commit a0930e3379
4 changed files with 34 additions and 31 deletions

View file

@ -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<String> cardTypesPresent = new LinkedHashSet<String>() {};
for (CardView card : cardsView.values()){
private int qtyCardTypes(mage.view.CardsView cardsView) {
Set<String> cardTypesPresent = new LinkedHashSet<String>() {
};
for (CardView card : cardsView.values()) {
Set<CardType> 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();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables

View file

@ -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();

View file

@ -70,7 +70,7 @@ public class CardView extends SimpleCardView {
protected String toughness;
protected String loyalty;
protected String startingLoyalty;
protected Set<CardType> cardTypes;
protected EnumSet<CardType> cardTypes;
protected List<String> subTypes;
protected List<String> 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();

View file

@ -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<CardType> cardTypes) {
private boolean sharesType(Card card, EnumSet<CardType> cardTypes) {
for (CardType type : card.getCardType()) {
if (cardTypes.contains(type)) {
return true;