();
/**
*
@@ -288,7 +288,7 @@ public abstract class GameEntity extends MyObservable {
/**
* Checks if is valid.
*
- * @param Restrictions
+ * @param restrictions
* the restrictions
* @param sourceController
* the source controller
@@ -296,20 +296,21 @@ public abstract class GameEntity extends MyObservable {
* the source
* @return true, if is valid
*/
- public boolean isValid(final String Restrictions[], final Player sourceController, final Card source) {
+ public boolean isValid(final String[] restrictions, final Player sourceController, final Card source) {
- for (int i = 0; i < Restrictions.length; i++) {
- if (isValid(Restrictions[i], sourceController, source))
+ for (int i = 0; i < restrictions.length; i++) {
+ if (isValid(restrictions[i], sourceController, source)) {
return true;
+ }
}
return false;
- }// isValid
+ } // isValid
/**
* Checks if is valid.
*
- * @param Restriction
+ * @param restriction
* the restriction
* @param sourceController
* the source controller
@@ -317,14 +318,14 @@ public abstract class GameEntity extends MyObservable {
* the source
* @return true, if is valid
*/
- public boolean isValid(final String Restriction, final Player sourceController, final Card source) {
+ public boolean isValid(final String restriction, final Player sourceController, final Card source) {
return false;
}
/**
* Checks for property.
*
- * @param Property
+ * @param property
* the property
* @param sourceController
* the source controller
@@ -332,7 +333,7 @@ public abstract class GameEntity extends MyObservable {
* the source
* @return true, if successful
*/
- public boolean hasProperty(String Property, final Player sourceController, final Card source) {
+ public boolean hasProperty(String property, final Player sourceController, final Card source) {
return false;
}
diff --git a/src/main/java/forge/GuiDisplay4.java b/src/main/java/forge/GuiDisplay4.java
index 945e522de8d..8f323139665 100644
--- a/src/main/java/forge/GuiDisplay4.java
+++ b/src/main/java/forge/GuiDisplay4.java
@@ -110,22 +110,22 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
private GuiInput inputControl;
/** The stat font. */
- Font statFont = new Font("Dialog", Font.PLAIN, 12);
+ private Font statFont = new Font("Dialog", Font.PLAIN, 12);
/** The life font. */
- Font lifeFont = new Font("Dialog", Font.PLAIN, 40);
+ private Font lifeFont = new Font("Dialog", Font.PLAIN, 40);
// Font checkboxFont = new Font("Dialog", Font.PLAIN, 9);
/** Constant greenColor. */
- public static Color greenColor = new Color(0, 164, 0);
+ private static Color greenColor = new Color(0, 164, 0);
- private Action HUMAN_GRAVEYARD_ACTION;
- private Action HUMAN_REMOVED_ACTION;
- private Action HUMAN_FLASHBACK_ACTION;
- private Action COMPUTER_GRAVEYARD_ACTION;
- private Action COMPUTER_REMOVED_ACTION;
- private Action CONCEDE_ACTION;
- private Action HUMAN_DECKLIST_ACTION;
+ private Action humanGraveyardAction;
+ private Action humanRemovedACtion;
+ private Action humanFlashbackAction;
+ private Action computerGraveyardAction;
+ private Action computerRemovedAction;
+ private Action concedeAction;
+ private Action humanDecklistAction;
// public Card cCardHQ;
// private CardList multiBlockers = new CardList();
@@ -177,9 +177,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
*
*/
private void setupActions() {
- HUMAN_GRAVEYARD_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_GRAVEYARD);
- HUMAN_REMOVED_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), HUMAN_REMOVED);
- HUMAN_FLASHBACK_ACTION = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_FLASHBACK) {
+ humanGraveyardAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_GRAVEYARD);
+ humanRemovedACtion = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Exile), HUMAN_REMOVED);
+ humanFlashbackAction = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Graveyard), HUMAN_FLASHBACK) {
private static final long serialVersionUID = 8120331222693706164L;
@@ -194,12 +194,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
AllZone.getGameAction().playCard(c);
}
};
- COMPUTER_GRAVEYARD_ACTION = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Graveyard),
+ computerGraveyardAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Graveyard),
COMPUTER_GRAVEYARD);
- COMPUTER_REMOVED_ACTION = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED);
- CONCEDE_ACTION = new ConcedeAction();
+ computerRemovedAction = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Exile), COMPUTER_REMOVED);
+ concedeAction = new ConcedeAction();
- HUMAN_DECKLIST_ACTION = new DeckListAction(HUMAN_DECKLIST);
+ humanDecklistAction = new DeckListAction(HUMAN_DECKLIST);
}
/**
@@ -212,9 +212,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
triggerMenu = new TriggerReactionMenu();
// Game Menu Creation
- Object[] obj = { HUMAN_DECKLIST_ACTION, HUMAN_GRAVEYARD_ACTION, HUMAN_REMOVED_ACTION, HUMAN_FLASHBACK_ACTION,
- COMPUTER_GRAVEYARD_ACTION, COMPUTER_REMOVED_ACTION, new JSeparator(), playsoundCheckboxForMenu,
- new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, CONCEDE_ACTION };
+ Object[] obj = { humanDecklistAction, humanGraveyardAction, humanRemovedACtion, humanFlashbackAction,
+ computerGraveyardAction, computerRemovedAction, new JSeparator(), playsoundCheckboxForMenu,
+ new JSeparator(), ErrorViewer.ALL_THREADS_ACTION, concedeAction };
JMenu gameMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.MENU.TITLE));
for (Object o : obj) {
@@ -254,7 +254,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
Action viewAIHand = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Hand), COMPUTER_HAND.BASE);
Action viewAILibrary = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Library),
COMPUTER_LIBRARY.BASE);
- Action viewHumanLibrary = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Library), HUMAN_LIBRARY.BASE);
+ Action viewHumanLibrary
+ = new ZoneAction(AllZone.getHumanPlayer().getZone(Zone.Library), HUMAN_LIBRARY.BASE);
ForgeAction generateMana = new ForgeAction(MANAGEN) {
private static final long serialVersionUID = 7171104690016706405L;
@@ -1189,8 +1190,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
oppHandLabel.setFont(statFont);
}
- JButton oppGraveButton = new JButton(COMPUTER_GRAVEYARD_ACTION);
- oppGraveButton.setText((String) COMPUTER_GRAVEYARD_ACTION.getValue("buttonText"));
+ JButton oppGraveButton = new JButton(computerGraveyardAction);
+ oppGraveButton.setText((String) computerGraveyardAction.getValue("buttonText"));
oppGraveButton.setMargin(new Insets(0, 0, 0, 0));
oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1200,8 +1201,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
JPanel gravePanel = new JPanel(new BorderLayout());
gravePanel.add(oppGraveButton, BorderLayout.EAST);
- JButton oppRemovedButton = new JButton(COMPUTER_REMOVED_ACTION);
- oppRemovedButton.setText((String) COMPUTER_REMOVED_ACTION.getValue("buttonText"));
+ JButton oppRemovedButton = new JButton(computerRemovedAction);
+ oppRemovedButton.setText((String) computerRemovedAction.getValue("buttonText"));
oppRemovedButton.setMargin(new Insets(0, 0, 0, 0));
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1290,16 +1291,16 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
// JLabel playerGraveLabel = new JLabel("Grave:",
// SwingConstants.TRAILING);
- JButton playerGraveButton = new JButton(HUMAN_GRAVEYARD_ACTION);
- playerGraveButton.setText((String) HUMAN_GRAVEYARD_ACTION.getValue("buttonText"));
+ JButton playerGraveButton = new JButton(humanGraveyardAction);
+ playerGraveButton.setText((String) humanGraveyardAction.getValue("buttonText"));
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) {
playerGraveButton.setFont(statFont);
}
- JButton playerFlashBackButton = new JButton(HUMAN_FLASHBACK_ACTION);
- playerFlashBackButton.setText((String) HUMAN_FLASHBACK_ACTION.getValue("buttonText"));
+ JButton playerFlashBackButton = new JButton(humanFlashbackAction);
+ playerFlashBackButton.setText((String) humanFlashbackAction.getValue("buttonText"));
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1312,8 +1313,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
JPanel playerFBPanel = new JPanel(new BorderLayout());
playerFBPanel.add(playerFlashBackButton, BorderLayout.EAST);
- JButton playerRemovedButton = new JButton(HUMAN_REMOVED_ACTION);
- playerRemovedButton.setText((String) HUMAN_REMOVED_ACTION.getValue("buttonText"));
+ JButton playerRemovedButton = new JButton(humanRemovedACtion);
+ playerRemovedButton.setText((String) humanRemovedACtion.getValue("buttonText"));
playerRemovedButton.setMargin(new Insets(0, 0, 0, 0));
// removedButton.setHorizontalAlignment(SwingConstants.TRAILING);
if (!Singletons.getModel().getPreferences().lafFonts) {
@@ -1510,42 +1511,42 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
}
/** Constant playsoundCheckboxForMenu. */
- public static JCheckBoxMenuItem playsoundCheckboxForMenu = new JCheckBoxMenuItem("Play Sound", false);
+ private static JCheckBoxMenuItem playsoundCheckboxForMenu = new JCheckBoxMenuItem("Play Sound", false);
// Phases
/** Constant cbAIUpkeep. */
- public static JCheckBoxMenuItem cbAIUpkeep = new JCheckBoxMenuItem("Upkeep", true);
+ private static JCheckBoxMenuItem cbAIUpkeep = new JCheckBoxMenuItem("Upkeep", true);
/** Constant cbAIDraw. */
- public static JCheckBoxMenuItem cbAIDraw = new JCheckBoxMenuItem("Draw", true);
+ private static JCheckBoxMenuItem cbAIDraw = new JCheckBoxMenuItem("Draw", true);
/** Constant cbAIEndOfTurn. */
- public static JCheckBoxMenuItem cbAIEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
+ private static JCheckBoxMenuItem cbAIEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
/** Constant cbAIBeginCombat. */
- public static JCheckBoxMenuItem cbAIBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
+ private static JCheckBoxMenuItem cbAIBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
/** Constant cbAIEndCombat. */
- public static JCheckBoxMenuItem cbAIEndCombat = new JCheckBoxMenuItem("End Combat", true);
+ private static JCheckBoxMenuItem cbAIEndCombat = new JCheckBoxMenuItem("End Combat", true);
/** Constant cbHumanUpkeep. */
- public static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
+ private static JCheckBoxMenuItem cbHumanUpkeep = new JCheckBoxMenuItem("Upkeep", true);
/** Constant cbHumanDraw. */
- public static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
+ private static JCheckBoxMenuItem cbHumanDraw = new JCheckBoxMenuItem("Draw", true);
/** Constant cbHumanEndOfTurn. */
- public static JCheckBoxMenuItem cbHumanEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
+ private static JCheckBoxMenuItem cbHumanEndOfTurn = new JCheckBoxMenuItem("End of Turn", true);
/** Constant cbHumanBeginCombat. */
- public static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
+ private static JCheckBoxMenuItem cbHumanBeginCombat = new JCheckBoxMenuItem("Begin Combat", true);
/** Constant cbHumanEndCombat. */
- public static JCheckBoxMenuItem cbHumanEndCombat = new JCheckBoxMenuItem("End Combat", true);
+ private static JCheckBoxMenuItem cbHumanEndCombat = new JCheckBoxMenuItem("End Combat", true);
// ********** End of Phase stuff in Display ******************
// ****** Developer Mode *******
/** Constant canLoseByDecking. */
- public static JCheckBoxMenuItem canLoseByDecking = new JCheckBoxMenuItem("Lose by Decking", true);
+ private static JCheckBoxMenuItem canLoseByDecking = new JCheckBoxMenuItem("Lose by Decking", true);
// *****************************
diff --git a/src/main/java/forge/GuiDisplayUtil.java b/src/main/java/forge/GuiDisplayUtil.java
index 0a64bdbfd2f..4810540860d 100644
--- a/src/main/java/forge/GuiDisplayUtil.java
+++ b/src/main/java/forge/GuiDisplayUtil.java
@@ -60,11 +60,11 @@ public final class GuiDisplayUtil implements NewConstants {
return new MouseMotionAdapter() {
@Override
public void mouseMoved(final MouseEvent me) {
- JPanel panel = (JPanel) me.getSource();
- Object o = panel.getComponentAt(me.getPoint());
+ final JPanel panel = (JPanel) me.getSource();
+ final Object o = panel.getComponentAt(me.getPoint());
if ((o != null) && (o instanceof CardPanel)) {
- CardContainer cardPanel = (CardContainer) o;
+ final CardContainer cardPanel = (CardContainer) o;
visual.setCard(cardPanel.getCard());
}
} // mouseMoved
@@ -86,7 +86,7 @@ public final class GuiDisplayUtil implements NewConstants {
return BorderFactory.createEmptyBorder(2, 2, 2, 2);
}
java.awt.Color color;
- ArrayList list = CardUtil.getColors(card);
+ final ArrayList list = CardUtil.getColors(card);
if (card.isFaceDown()) {
color = Color.gray;
@@ -115,7 +115,7 @@ public final class GuiDisplayUtil implements NewConstants {
int g = color.getGreen();
int b = color.getBlue();
- int shade = 10;
+ final int shade = 10;
r -= shade;
g -= shade;
@@ -139,10 +139,10 @@ public final class GuiDisplayUtil implements NewConstants {
*
*/
public static void devModeGenerateMana() {
- Card dummy = new Card();
+ final Card dummy = new Card();
dummy.setOwner(AllZone.getHumanPlayer());
dummy.addController(AllZone.getHumanPlayer());
- Ability_Mana abMana = new Ability_Mana(dummy, "0", "W U B G R 1", 10) {
+ final Ability_Mana abMana = new Ability_Mana(dummy, "0", "W U B G R 1", 10) {
private static final long serialVersionUID = -2164401486331182356L;
};
@@ -159,15 +159,15 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.lang.String} object.
*/
public static String formatCardType(final Card card) {
- ArrayList list = card.getType();
- StringBuilder sb = new StringBuilder();
+ final ArrayList list = card.getType();
+ final StringBuilder sb = new StringBuilder();
- ArrayList superTypes = new ArrayList();
- ArrayList cardTypes = new ArrayList();
- ArrayList subTypes = new ArrayList();
- boolean allCreatureTypes = list.contains("AllCreatureTypes");
+ final ArrayList superTypes = new ArrayList();
+ final ArrayList cardTypes = new ArrayList();
+ final ArrayList subTypes = new ArrayList();
+ final boolean allCreatureTypes = list.contains("AllCreatureTypes");
- for (String t : list) {
+ for (final String t : list) {
if (allCreatureTypes && t.equals("AllCreatureTypes")) {
continue;
}
@@ -177,15 +177,16 @@ public final class GuiDisplayUtil implements NewConstants {
if (CardUtil.isACardType(t) && !cardTypes.contains(t)) {
cardTypes.add(t);
}
- if (CardUtil.isASubType(t) && !subTypes.contains(t) && (!allCreatureTypes || !CardUtil.isACreatureType(t))) {
+ if (CardUtil.isASubType(t) && !subTypes.contains(t)
+ && (!allCreatureTypes || !CardUtil.isACreatureType(t))) {
subTypes.add(t);
}
}
- for (String type : superTypes) {
+ for (final String type : superTypes) {
sb.append(type).append(" ");
}
- for (String type : cardTypes) {
+ for (final String type : cardTypes) {
sb.append(type).append(" ");
}
if (!subTypes.isEmpty() || allCreatureTypes) {
@@ -194,7 +195,7 @@ public final class GuiDisplayUtil implements NewConstants {
if (allCreatureTypes) {
sb.append("All creature types ");
}
- for (String type : subTypes) {
+ for (final String type : subTypes) {
sb.append(type).append(" ");
}
@@ -211,13 +212,13 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.lang.String} object.
*/
public static String cleanString(final String in) {
- StringBuffer out = new StringBuffer();
+ final StringBuffer out = new StringBuffer();
char c;
for (int i = 0; i < in.length(); i++) {
c = in.charAt(i);
- if (c == ' ' || c == '-') {
+ if ((c == ' ') || (c == '-')) {
out.append('_');
- } else if (Character.isLetterOrDigit(c) || c == '_') {
+ } else if (Character.isLetterOrDigit(c) || (c == '_')) {
out.append(c);
}
}
@@ -234,11 +235,11 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.lang.String} object.
*/
public static String cleanStringMWS(final String in) {
- StringBuffer out = new StringBuffer();
+ final StringBuffer out = new StringBuffer();
char c;
for (int i = 0; i < in.length(); i++) {
c = in.charAt(i);
- if (c == '"' || c == '/') {
+ if ((c == '"') || (c == '/')) {
out.append("");
} else {
out.append(c);
@@ -258,7 +259,7 @@ public final class GuiDisplayUtil implements NewConstants {
* an array of {@link forge.Card} objects.
*/
public static void setupNoLandPanel(final JPanel j, final Card[] c) {
- ArrayList a = new ArrayList();
+ final ArrayList a = new ArrayList();
/*
* for(int i = 0; i < c.length; i++) if(c[i].isCreature() ||
* c[i].isGlobalEnchantment() || c[i].isArtifact() ||
@@ -278,11 +279,11 @@ public final class GuiDisplayUtil implements NewConstants {
* (c[i].isGlobalEnchantment() && !c[i].isCreature()) a.add(c[i]);
*/
- for (int i = 0; i < c.length; i++) {
- a.add(c[i]);
+ for (final Card element : c) {
+ a.add(element);
}
- setupNoLandPermPanel(j, a, true);
+ GuiDisplayUtil.setupNoLandPermPanel(j, a, true);
}
/**
@@ -296,16 +297,16 @@ public final class GuiDisplayUtil implements NewConstants {
* an array of {@link forge.Card} objects.
*/
public static void setupLandPanel(final JPanel j, final Card[] c) {
- ArrayList a = new ArrayList();
+ final ArrayList a = new ArrayList();
for (int i = 0; i < c.length; i++) {
- if ((!(c[i].isCreature() || c[i].isEnchantment() || c[i].isArtifact() || c[i].isPlaneswalker()) || (c[i]
- .isLand() && c[i].isArtifact() && !c[i].isCreature() && !c[i].isEnchantment()))
- && !AllZone.getGameAction().isAttacheeByMindsDesire(c[i])
+ if (((!(c[i].isCreature() || c[i].isEnchantment() || c[i].isArtifact() || c[i].isPlaneswalker()) || (c[i]
+ .isLand() && c[i].isArtifact() && !c[i].isCreature() && !c[i].isEnchantment())) && !AllZone
+ .getGameAction().isAttacheeByMindsDesire(c[i]))
|| (c[i].getName().startsWith("Mox") && !c[i].getName().equals("Mox Diamond"))) {
a.add(c[i]);
}
}
- setupPanel(j, a, true);
+ GuiDisplayUtil.setupPanel(j, a, true);
}
/*
@@ -352,31 +353,31 @@ public final class GuiDisplayUtil implements NewConstants {
// add all Cards in list to the GUI, add arrows to Local
// Enchantments
- ArrayList manaPools = getManaPools(list);
- ArrayList enchantedLands = getEnchantedLands(list);
- ArrayList basicBlues = getBasics(list, Constant.Color.BLUE);
- ArrayList basicReds = getBasics(list, Constant.Color.RED);
- ArrayList basicBlacks = getBasics(list, Constant.Color.BLACK);
- ArrayList basicGreens = getBasics(list, Constant.Color.GREEN);
- ArrayList basicWhites = getBasics(list, Constant.Color.WHITE);
- ArrayList badlands = getNonBasicLand(list, "Badlands");
- ArrayList bayou = getNonBasicLand(list, "Bayou");
- ArrayList plateau = getNonBasicLand(list, "Plateau");
- ArrayList scrubland = getNonBasicLand(list, "Scrubland");
- ArrayList savannah = getNonBasicLand(list, "Savannah");
- ArrayList taiga = getNonBasicLand(list, "Taiga");
- ArrayList tropicalIsland = getNonBasicLand(list, "Tropical Island");
- ArrayList tundra = getNonBasicLand(list, "Tundra");
- ArrayList undergroundSea = getNonBasicLand(list, "Underground Sea");
- ArrayList volcanicIsland = getNonBasicLand(list, "Volcanic Island");
+ final ArrayList manaPools = GuiDisplayUtil.getManaPools(list);
+ final ArrayList enchantedLands = GuiDisplayUtil.getEnchantedLands(list);
+ final ArrayList basicBlues = GuiDisplayUtil.getBasics(list, Constant.Color.BLUE);
+ final ArrayList basicReds = GuiDisplayUtil.getBasics(list, Constant.Color.RED);
+ final ArrayList basicBlacks = GuiDisplayUtil.getBasics(list, Constant.Color.BLACK);
+ final ArrayList basicGreens = GuiDisplayUtil.getBasics(list, Constant.Color.GREEN);
+ final ArrayList basicWhites = GuiDisplayUtil.getBasics(list, Constant.Color.WHITE);
+ final ArrayList badlands = GuiDisplayUtil.getNonBasicLand(list, "Badlands");
+ final ArrayList bayou = GuiDisplayUtil.getNonBasicLand(list, "Bayou");
+ final ArrayList plateau = GuiDisplayUtil.getNonBasicLand(list, "Plateau");
+ final ArrayList scrubland = GuiDisplayUtil.getNonBasicLand(list, "Scrubland");
+ final ArrayList savannah = GuiDisplayUtil.getNonBasicLand(list, "Savannah");
+ final ArrayList taiga = GuiDisplayUtil.getNonBasicLand(list, "Taiga");
+ final ArrayList tropicalIsland = GuiDisplayUtil.getNonBasicLand(list, "Tropical Island");
+ final ArrayList tundra = GuiDisplayUtil.getNonBasicLand(list, "Tundra");
+ final ArrayList undergroundSea = GuiDisplayUtil.getNonBasicLand(list, "Underground Sea");
+ final ArrayList volcanicIsland = GuiDisplayUtil.getNonBasicLand(list, "Volcanic Island");
- ArrayList nonBasics = getNonBasics(list);
+ final ArrayList nonBasics = GuiDisplayUtil.getNonBasics(list);
- ArrayList moxEmerald = getMoxen(list, "Mox Emerald");
- ArrayList moxJet = getMoxen(list, "Mox Jet");
- ArrayList moxPearl = getMoxen(list, "Mox Pearl");
- ArrayList moxRuby = getMoxen(list, "Mox Ruby");
- ArrayList moxSapphire = getMoxen(list, "Mox Sapphire");
+ final ArrayList moxEmerald = GuiDisplayUtil.getMoxen(list, "Mox Emerald");
+ final ArrayList moxJet = GuiDisplayUtil.getMoxen(list, "Mox Jet");
+ final ArrayList moxPearl = GuiDisplayUtil.getMoxen(list, "Mox Pearl");
+ final ArrayList moxRuby = GuiDisplayUtil.getMoxen(list, "Mox Ruby");
+ final ArrayList moxSapphire = GuiDisplayUtil.getMoxen(list, "Mox Sapphire");
// ArrayList moxDiamond = getMoxen(list, "Mox Diamond");
list = new ArrayList();
@@ -409,17 +410,17 @@ public final class GuiDisplayUtil implements NewConstants {
int atInStack = 0;
- int marginX = 5;
- int marginY = 5;
+ final int marginX = 5;
+ final int marginY = 5;
int x = marginX;
- int cardOffset = Constant.Runtime.STACK_OFFSET[0];
+ final int cardOffset = Constant.Runtime.STACK_OFFSET[0];
String color = "";
- ArrayList cards = new ArrayList();
+ final ArrayList cards = new ArrayList();
- ArrayList connectedCards = new ArrayList();
+ final ArrayList connectedCards = new ArrayList();
boolean nextEnchanted = false;
Card prevCard = null;
@@ -432,10 +433,10 @@ public final class GuiDisplayUtil implements NewConstants {
boolean startANewStack = false;
- if (!isStackable(c)) {
+ if (!GuiDisplayUtil.isStackable(c)) {
startANewStack = true;
} else {
- String newColor = c.getName(); // CardUtil.getColor(c);
+ final String newColor = c.getName(); // CardUtil.getColor(c);
if (!newColor.equals(color)) {
startANewStack = true;
@@ -447,7 +448,7 @@ public final class GuiDisplayUtil implements NewConstants {
startANewStack = false;
}
- if (!startANewStack && atInStack == Constant.Runtime.STACK_SIZE[0]) {
+ if (!startANewStack && (atInStack == Constant.Runtime.STACK_SIZE[0])) {
startANewStack = true;
}
@@ -468,10 +469,10 @@ public final class GuiDisplayUtil implements NewConstants {
// a land is enchanted, and there are more lands of that same
// name
- else if ((prevCard != null && c.isLand() && prevCard.isLand() && prevCard.isEnchanted() && prevCard
+ else if (((prevCard != null) && c.isLand() && prevCard.isLand() && prevCard.isEnchanted() && prevCard
.getName().equals(c.getName()))) {
startANewStack = true;
- } else if (prevCard != null && c.isLand() && prevCard.isLand()
+ } else if ((prevCard != null) && c.isLand() && prevCard.isLand()
&& !prevCard.getName().equals(c.getName())) {
startANewStack = true;
}
@@ -481,15 +482,15 @@ public final class GuiDisplayUtil implements NewConstants {
* true; System.out.println("startANewStack: " +
* startANewStack); }
*/
- if (c.isAura() && c.isEnchanting() && prevCard != null && prevCard instanceof ManaPool) {
+ if (c.isAura() && c.isEnchanting() && (prevCard != null) && (prevCard instanceof ManaPool)) {
startANewStack = true;
}
- if (c instanceof ManaPool && prevCard instanceof ManaPool && prevCard.isSnow()) {
+ if ((c instanceof ManaPool) && (prevCard instanceof ManaPool) && prevCard.isSnow()) {
startANewStack = false;
}
if (startANewStack) {
- setupConnectedCards(connectedCards);
+ GuiDisplayUtil.setupConnectedCards(connectedCards);
connectedCards.clear();
// Fixed distance if last was a stack, looks a bit nicer
@@ -508,7 +509,7 @@ public final class GuiDisplayUtil implements NewConstants {
nextXIfNotStacked = x + marginX + addPanel.getPreferredSize().width;
- int xLoc = x;
+ final int xLoc = x;
int yLoc = marginY;
yLoc += atInStack * cardOffset;
@@ -524,11 +525,11 @@ public final class GuiDisplayUtil implements NewConstants {
prevCard = c;
}
- setupConnectedCards(connectedCards);
+ GuiDisplayUtil.setupConnectedCards(connectedCards);
connectedCards.clear();
for (int i = cards.size() - 1; i >= 0; i--) {
- JPanel card = cards.get(i);
+ final JPanel card = cards.get(i);
// maxX = Math.max(maxX, card.getLocation().x +
// card.getSize().width + marginX);
maxY = Math.max(maxY, card.getLocation().y + card.getSize().height + marginY);
@@ -538,8 +539,8 @@ public final class GuiDisplayUtil implements NewConstants {
maxX = nextXIfNotStacked;
// System.out.println("x:" + maxX + ", y:" + maxY);
- if (maxX > 0 && maxY > 0) { // p.getSize().width || maxY >
- // p.getSize().height) {
+ if ((maxX > 0) && (maxY > 0)) { // p.getSize().width || maxY >
+ // p.getSize().height) {
// p.setSize(new Dimension(maxX, maxY));
p.setPreferredSize(new Dimension(maxX, maxY));
}
@@ -584,22 +585,23 @@ public final class GuiDisplayUtil implements NewConstants {
// add all Cards in list to the GUI, add arrows to Local
// Enchantments
- ArrayList planeswalkers = getPlaneswalkers(list);
+ final ArrayList planeswalkers = GuiDisplayUtil.getPlaneswalkers(list);
// this will also fetch the equipment and/or enchantment
- ArrayList equippedEnchantedCreatures = getEquippedEnchantedCreatures(list);
- ArrayList nonTokenCreatures = getNonTokenCreatures(list);
- ArrayList tokenCreatures = getTokenCreatures(list);
+ final ArrayList equippedEnchantedCreatures = GuiDisplayUtil.getEquippedEnchantedCreatures(list);
+ final ArrayList nonTokenCreatures = GuiDisplayUtil.getNonTokenCreatures(list);
+ final ArrayList tokenCreatures = GuiDisplayUtil.getTokenCreatures(list);
// sort tokenCreatures by name (TODO fix the warning message
// somehow)
Collections.sort(tokenCreatures, new Comparator() {
+ @Override
public int compare(final Card c1, final Card c2) {
return c1.getName().compareTo(c2.getName());
}
});
- ArrayList artifacts = getNonCreatureArtifacts(list);
- ArrayList enchantments = getGlobalEnchantments(list);
+ final ArrayList artifacts = GuiDisplayUtil.getNonCreatureArtifacts(list);
+ final ArrayList enchantments = GuiDisplayUtil.getGlobalEnchantments(list);
// ArrayList nonBasics = getNonBasics(list);
list = new ArrayList();
@@ -612,17 +614,17 @@ public final class GuiDisplayUtil implements NewConstants {
int atInStack = 0;
- int marginX = 5;
- int marginY = 5;
+ final int marginX = 5;
+ final int marginY = 5;
int x = marginX;
- int cardOffset = Constant.Runtime.STACK_OFFSET[0];
+ final int cardOffset = Constant.Runtime.STACK_OFFSET[0];
String color = "";
- ArrayList cards = new ArrayList();
+ final ArrayList cards = new ArrayList();
- ArrayList connectedCards = new ArrayList();
+ final ArrayList connectedCards = new ArrayList();
boolean nextEquippedEnchanted = false;
int nextXIfNotStacked = 0;
@@ -634,10 +636,10 @@ public final class GuiDisplayUtil implements NewConstants {
boolean startANewStack = false;
- if (!isStackable(c)) {
+ if (!GuiDisplayUtil.isStackable(c)) {
startANewStack = true;
} else {
- String newColor = c.getName(); // CardUtil.getColor(c);
+ final String newColor = c.getName(); // CardUtil.getColor(c);
if (!newColor.equals(color)) {
startANewStack = true;
@@ -649,11 +651,12 @@ public final class GuiDisplayUtil implements NewConstants {
startANewStack = false;
}
- if (!startANewStack && atInStack == Constant.Runtime.STACK_SIZE[0]) {
+ if (!startANewStack && (atInStack == Constant.Runtime.STACK_SIZE[0])) {
startANewStack = true;
}
- if ((c.isEquipment() || c.isAura()) && (c.isEquipping() || c.isEnchanting()) && !nextEquippedEnchanted) {
+ if ((c.isEquipment() || c.isAura()) && (c.isEquipping()
+ || c.isEnchanting()) && !nextEquippedEnchanted) {
startANewStack = false;
} else if ((c.isEquipment() || c.isAura()) && (c.isEquipping() || c.isEnchanting())) {
startANewStack = true;
@@ -668,21 +671,22 @@ public final class GuiDisplayUtil implements NewConstants {
// correctly when a token
// is equipped/enchanted, and there are more tokens of that same
// name
- else if ((prevCard != null && c.isCreature() && prevCard.isCreature()
- && (prevCard.isEquipped() || prevCard.isEnchanted()) && prevCard.getName().equals(c.getName()))) {
+ else if (((prevCard != null) && c.isCreature() && prevCard.isCreature()
+ && (prevCard.isEquipped() || prevCard.isEnchanted())
+ && prevCard.getName().equals(c.getName()))) {
startANewStack = true;
- } else if (prevCard != null && c.isCreature() && prevCard.isCreature()
+ } else if ((prevCard != null) && c.isCreature() && prevCard.isCreature()
&& !prevCard.getName().equals(c.getName())) {
startANewStack = true;
}
- if (((c.isAura() && c.isEnchanting()) || (c.isEquipment() && c.isEquipping())) && prevCard != null
+ if (((c.isAura() && c.isEnchanting()) || (c.isEquipment() && c.isEquipping())) && (prevCard != null)
&& prevCard.isPlaneswalker()) {
startANewStack = true;
}
if (startANewStack) {
- setupConnectedCards(connectedCards);
+ GuiDisplayUtil.setupConnectedCards(connectedCards);
connectedCards.clear();
// Fixed distance if last was a stack, looks a bit nicer
@@ -701,7 +705,7 @@ public final class GuiDisplayUtil implements NewConstants {
nextXIfNotStacked = x + marginX + addPanel.getPreferredSize().width;
- int xLoc = x;
+ final int xLoc = x;
int yLoc = marginY;
yLoc += atInStack * cardOffset;
@@ -717,11 +721,11 @@ public final class GuiDisplayUtil implements NewConstants {
prevCard = c;
}
- setupConnectedCards(connectedCards);
+ GuiDisplayUtil.setupConnectedCards(connectedCards);
connectedCards.clear();
for (int i = cards.size() - 1; i >= 0; i--) {
- JPanel card = cards.get(i);
+ final JPanel card = cards.get(i);
// maxX = Math.max(maxX, card.getLocation().x +
// card.getSize().width + marginX);
maxY = Math.max(maxY, card.getLocation().y + card.getSize().height + marginY);
@@ -730,8 +734,8 @@ public final class GuiDisplayUtil implements NewConstants {
maxX = nextXIfNotStacked;
- if (maxX > 0 && maxY > 0) { // p.getSize().width || maxY >
- // p.getSize().height) {
+ if ((maxX > 0) && (maxY > 0)) { // p.getSize().width || maxY >
+ // p.getSize().height) {
p.setPreferredSize(new Dimension(maxX, maxY));
}
@@ -756,8 +760,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getPlaneswalkers(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.isPlaneswalker() && !c.isArtifact()) {
ret.add(c);
}
@@ -775,8 +779,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getEquippedEnchantedCreatures(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.isCreature() && (c.isEquipped() || c.isEnchanted())) {
if (c.isEquipped()) {
ret.addAll(c.getEquippedBy());
@@ -802,8 +806,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getNonTokenCreatures(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.isCreature() && !c.isToken() && !c.isEquipped() && !c.isEnchanted()) {
ret.add(c);
}
@@ -821,8 +825,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getTokenCreatures(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.isCreature() && c.isToken() && !c.isEquipped() && !c.isEnchanted()) {
ret.add(c);
}
@@ -842,9 +846,9 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getTokenCreatures(final ArrayList cards, final String tokenName) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
- String name = c.getName();
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
+ final String name = c.getName();
if (c.isCreature() && c.isToken() && name.equals(tokenName)) {
ret.add(c);
}
@@ -864,9 +868,9 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getMoxen(final ArrayList cards, final String moxName) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
- String name = c.getName();
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
+ final String name = c.getName();
if (name.equals(moxName) && !c.isCreature()) {
ret.add(c);
}
@@ -884,9 +888,9 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getNonCreatureArtifacts(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
- String name = c.getName();
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
+ final String name = c.getName();
if (c.isArtifact() && !c.isCreature() && !c.isLand() && !c.isGlobalEnchantment()
&& !(c.isEquipment() && c.isEquipping()) && !name.equals("Mox Emerald") && !name.equals("Mox Jet")
&& !name.equals("Mox Pearl") && !name.equals("Mox Ruby") && !name.equals("Mox Sapphire")) {
@@ -906,8 +910,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getGlobalEnchantments(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.isGlobalEnchantment() && !c.isCreature()) {
ret.add(c);
}
@@ -927,8 +931,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getCard(final ArrayList cards, final String name) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.getName().equals(name)) {
ret.add(c);
}
@@ -946,8 +950,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getEnchantedLands(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c.isLand() && c.isEnchanted()) {
ret.addAll(c.getEnchantedBy());
ret.add(c);
@@ -969,10 +973,10 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getBasics(final ArrayList cards, final String color) {
- ArrayList ret = new ArrayList();
+ final ArrayList ret = new ArrayList();
- for (Card c : cards) {
- String name = c.getName();
+ for (final Card c : cards) {
+ final String name = c.getName();
if (c.isEnchanted()) {
// do nothing
@@ -1017,13 +1021,13 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getNonBasics(final ArrayList cards) {
- ArrayList ret = new ArrayList();
+ final ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ for (final Card c : cards) {
if (!c.isLand() && !c.getName().startsWith("Mox") && !(c instanceof ManaPool)) {
ret.add(c);
} else {
- String name = c.getName();
+ final String name = c.getName();
if (c.isEnchanted() || name.equals("Swamp") || name.equals("Bog") || name.equals("Forest")
|| name.equals("Grass") || name.equals("Plains") || name.equals("White Sand")
|| name.equals("Mountain") || name.equals("Rock") || name.equals("Island")
@@ -1031,7 +1035,7 @@ public final class GuiDisplayUtil implements NewConstants {
|| name.equals("Plateau") || name.equals("Scrubland") || name.equals("Savannah")
|| name.equals("Taiga") || name.equals("Tropical Island") || name.equals("Tundra")
|| name.equals("Underground Sea") || name.equals("Volcanic Island") || name.startsWith("Mox")
- || c instanceof ManaPool) {
+ || (c instanceof ManaPool)) {
// do nothing.
} else {
ret.add(c);
@@ -1054,9 +1058,9 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getNonBasicLand(final ArrayList cards, final String landName) {
- ArrayList ret = new ArrayList();
+ final ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ for (final Card c : cards) {
if (c.getName().equals(landName)) {
ret.add(c);
}
@@ -1075,8 +1079,8 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getManaPools(final ArrayList cards) {
- ArrayList ret = new ArrayList();
- for (Card c : cards) {
+ final ArrayList ret = new ArrayList();
+ for (final Card c : cards) {
if (c instanceof ManaPool) {
ret.add(c);
}
@@ -1098,7 +1102,7 @@ public final class GuiDisplayUtil implements NewConstants {
|| (c.isLand() && c.isEnchanted()) || (c.isAura() && c.isEnchanting())
|| (c.isToken() && CardFactoryUtil.multipleControlled(c))
|| (c.isCreature() && (c.isEquipped() || c.isEnchanted())) || (c.isEquipment() && c.isEquipping())
- || (c.isEnchantment()) || (c instanceof ManaPool && c.isSnow())) {
+ || (c.isEnchantment()) || ((c instanceof ManaPool) && c.isSnow())) {
return true;
}
@@ -1117,7 +1121,7 @@ public final class GuiDisplayUtil implements NewConstants {
public static void setupConnectedCards(final ArrayList connectedCards) {
for (int i = connectedCards.size() - 1; i > 0; i--) {
// System.out.println("We should have a stack");
- CardPanel cp = connectedCards.get(i);
+ final CardPanel cp = connectedCards.get(i);
cp.connectedCard = connectedCards.get(i - 1);
}
}
@@ -1137,7 +1141,7 @@ public final class GuiDisplayUtil implements NewConstants {
public static void setupPlayZone(final PlayArea p, final Card[] c) {
List tmp, diff;
tmp = new ArrayList();
- for (arcane.ui.CardPanel cpa : p.getCardPanels()) {
+ for (final arcane.ui.CardPanel cpa : p.getCardPanels()) {
tmp.add(cpa.getGameCard());
}
diff = new ArrayList(tmp);
@@ -1145,7 +1149,7 @@ public final class GuiDisplayUtil implements NewConstants {
if (diff.size() == p.getCardPanels().size()) {
p.clear();
} else {
- for (Card card : diff) {
+ for (final Card card : diff) {
p.removeCardPanel(p.getCardPanel(card.getUniqueNumber()));
}
}
@@ -1153,12 +1157,12 @@ public final class GuiDisplayUtil implements NewConstants {
diff.removeAll(tmp);
arcane.ui.CardPanel toPanel = null;
- for (Card card : diff) {
+ for (final Card card : diff) {
toPanel = p.addCard(card);
Animation.moveCard(toPanel);
}
- for (Card card : c) {
+ for (final Card card : c) {
toPanel = p.getCardPanel(card.getUniqueNumber());
if (card.isTapped()) {
toPanel.setTapped(true);
@@ -1169,9 +1173,9 @@ public final class GuiDisplayUtil implements NewConstants {
}
toPanel.getAttachedPanels().clear();
if (card.isEnchanted()) {
- ArrayList enchants = card.getEnchantedBy();
- for (Card e : enchants) {
- arcane.ui.CardPanel cardE = p.getCardPanel(e.getUniqueNumber());
+ final ArrayList enchants = card.getEnchantedBy();
+ for (final Card e : enchants) {
+ final arcane.ui.CardPanel cardE = p.getCardPanel(e.getUniqueNumber());
if (cardE != null) {
toPanel.getAttachedPanels().add(cardE);
}
@@ -1179,9 +1183,9 @@ public final class GuiDisplayUtil implements NewConstants {
}
if (card.isEquipped()) {
- ArrayList enchants = card.getEquippedBy();
- for (Card e : enchants) {
- arcane.ui.CardPanel cardE = p.getCardPanel(e.getUniqueNumber());
+ final ArrayList enchants = card.getEquippedBy();
+ for (final Card e : enchants) {
+ final arcane.ui.CardPanel cardE = p.getCardPanel(e.getUniqueNumber());
if (cardE != null) {
toPanel.getAttachedPanels().add(cardE);
}
@@ -1221,37 +1225,37 @@ public final class GuiDisplayUtil implements NewConstants {
*
*/
public static void devSetupGameState() {
- String t_humanLife = "-1";
- String t_computerLife = "-1";
- String t_humanSetupCardsInPlay = "NONE";
- String t_computerSetupCardsInPlay = "NONE";
- String t_humanSetupCardsInHand = "NONE";
- String t_computerSetupCardsInHand = "NONE";
- String t_humanSetupGraveyard = "NONE";
- String t_computerSetupGraveyard = "NONE";
- String t_humanSetupLibrary = "NONE";
- String t_computerSetupLibrary = "NONE";
- String t_humanSetupExile = "NONE";
- String t_computerSetupExile = "NONE";
- String t_changePlayer = "NONE";
- String t_changePhase = "NONE";
+ String tHumanLife = "-1";
+ String tComputerLife = "-1";
+ String tHumanSetupCardsInPlay = "NONE";
+ String tComputerSetupCardsInPlay = "NONE";
+ String tHumanSetupCardsInHand = "NONE";
+ String tComputerSetupCardsInHand = "NONE";
+ String tHumanSetupGraveyard = "NONE";
+ String tComputerSetupGraveyard = "NONE";
+ String tHumanSetupLibrary = "NONE";
+ String tComputerSetupLibrary = "NONE";
+ String tHumanSetupExile = "NONE";
+ String tComputerSetupExile = "NONE";
+ String tChangePlayer = "NONE";
+ String tChangePhase = "NONE";
- String wd = ".";
- JFileChooser fc = new JFileChooser(wd);
- int rc = fc.showDialog(null, "Select Game State File");
+ final String wd = ".";
+ final JFileChooser fc = new JFileChooser(wd);
+ final int rc = fc.showDialog(null, "Select Game State File");
if (rc != JFileChooser.APPROVE_OPTION) {
return;
}
try {
- FileInputStream fstream = new FileInputStream(fc.getSelectedFile().getAbsolutePath());
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ final FileInputStream fstream = new FileInputStream(fc.getSelectedFile().getAbsolutePath());
+ final DataInputStream in = new DataInputStream(fstream);
+ final BufferedReader br = new BufferedReader(new InputStreamReader(in));
String temp = "";
while ((temp = br.readLine()) != null) {
- String[] tempData = temp.split("=");
+ final String[] tempData = temp.split("=");
if (tempData.length < 2) {
continue;
@@ -1260,61 +1264,61 @@ public final class GuiDisplayUtil implements NewConstants {
continue;
}
- String categoryName = tempData[0];
- String categoryValue = tempData[1];
+ final String categoryName = tempData[0];
+ final String categoryValue = tempData[1];
if (categoryName.toLowerCase().equals("humanlife")) {
- t_humanLife = categoryValue;
+ tHumanLife = categoryValue;
} else if (categoryName.toLowerCase().equals("ailife")) {
- t_computerLife = categoryValue;
+ tComputerLife = categoryValue;
} else if (categoryName.toLowerCase().equals("humancardsinplay")) {
- t_humanSetupCardsInPlay = categoryValue;
+ tHumanSetupCardsInPlay = categoryValue;
} else if (categoryName.toLowerCase().equals("aicardsinplay")) {
- t_computerSetupCardsInPlay = categoryValue;
+ tComputerSetupCardsInPlay = categoryValue;
} else if (categoryName.toLowerCase().equals("humancardsinhand")) {
- t_humanSetupCardsInHand = categoryValue;
+ tHumanSetupCardsInHand = categoryValue;
} else if (categoryName.toLowerCase().equals("aicardsinhand")) {
- t_computerSetupCardsInHand = categoryValue;
+ tComputerSetupCardsInHand = categoryValue;
} else if (categoryName.toLowerCase().equals("humancardsingraveyard")) {
- t_humanSetupGraveyard = categoryValue;
+ tHumanSetupGraveyard = categoryValue;
} else if (categoryName.toLowerCase().equals("aicardsingraveyard")) {
- t_computerSetupGraveyard = categoryValue;
+ tComputerSetupGraveyard = categoryValue;
} else if (categoryName.toLowerCase().equals("humancardsinlibrary")) {
- t_humanSetupLibrary = categoryValue;
+ tHumanSetupLibrary = categoryValue;
} else if (categoryName.toLowerCase().equals("aicardsinlibrary")) {
- t_computerSetupLibrary = categoryValue;
+ tComputerSetupLibrary = categoryValue;
} else if (categoryName.toLowerCase().equals("humancardsinexile")) {
- t_humanSetupExile = categoryValue;
+ tHumanSetupExile = categoryValue;
} else if (categoryName.toLowerCase().equals("aicardsinexile")) {
- t_computerSetupExile = categoryValue;
+ tComputerSetupExile = categoryValue;
} else if (categoryName.toLowerCase().equals("activeplayer")) {
- t_changePlayer = categoryValue;
+ tChangePlayer = categoryValue;
} else if (categoryName.toLowerCase().equals("activephase")) {
- t_changePhase = categoryValue;
+ tChangePhase = categoryValue;
}
}
in.close();
- } catch (FileNotFoundException fnfe) {
+ } catch (final FileNotFoundException fnfe) {
JOptionPane.showMessageDialog(null, "File not found: " + fc.getSelectedFile().getAbsolutePath());
- } catch (Exception e) {
+ } catch (final Exception e) {
JOptionPane.showMessageDialog(null, "Error loading battle setup file!");
return;
}
- int setHumanLife = Integer.parseInt(t_humanLife);
- int setComputerLife = Integer.parseInt(t_computerLife);
+ final int setHumanLife = Integer.parseInt(tHumanLife);
+ final int setComputerLife = Integer.parseInt(tComputerLife);
- String[] humanSetupCardsInPlay = t_humanSetupCardsInPlay.split(";");
- String[] computerSetupCardsInPlay = t_computerSetupCardsInPlay.split(";");
- String[] humanSetupCardsInHand = t_humanSetupCardsInHand.split(";");
- String[] computerSetupCardsInHand = t_computerSetupCardsInHand.split(";");
- String[] humanSetupGraveyard = t_humanSetupGraveyard.split(";");
- String[] computerSetupGraveyard = t_computerSetupGraveyard.split(";");
- String[] humanSetupLibrary = t_humanSetupLibrary.split(";");
- String[] computerSetupLibrary = t_computerSetupLibrary.split(";");
- String[] humanSetupExile = t_humanSetupExile.split(";");
- String[] computerSetupExile = t_computerSetupExile.split(";");
+ final String[] humanSetupCardsInPlay = tHumanSetupCardsInPlay.split(";");
+ final String[] computerSetupCardsInPlay = tComputerSetupCardsInPlay.split(";");
+ final String[] humanSetupCardsInHand = tHumanSetupCardsInHand.split(";");
+ final String[] computerSetupCardsInHand = tComputerSetupCardsInHand.split(";");
+ final String[] humanSetupGraveyard = tHumanSetupGraveyard.split(";");
+ final String[] computerSetupGraveyard = tComputerSetupGraveyard.split(";");
+ final String[] humanSetupLibrary = tHumanSetupLibrary.split(";");
+ final String[] computerSetupLibrary = tComputerSetupLibrary.split(";");
+ final String[] humanSetupExile = tHumanSetupExile.split(";");
+ final String[] computerSetupExile = tComputerSetupExile.split(";");
CardList humanDevSetup = new CardList();
CardList computerDevSetup = new CardList();
@@ -1327,68 +1331,74 @@ public final class GuiDisplayUtil implements NewConstants {
CardList humanDevExileSetup = new CardList();
CardList computerDevExileSetup = new CardList();
- if (!t_changePlayer.trim().toLowerCase().equals("none")) {
- if (t_changePlayer.trim().toLowerCase().equals("human")) {
+ if (!tChangePlayer.trim().toLowerCase().equals("none")) {
+ if (tChangePlayer.trim().toLowerCase().equals("human")) {
AllZone.getPhase().setPlayerTurn(AllZone.getHumanPlayer());
}
- if (t_changePlayer.trim().toLowerCase().equals("ai")) {
+ if (tChangePlayer.trim().toLowerCase().equals("ai")) {
AllZone.getPhase().setPlayerTurn(AllZone.getComputerPlayer());
}
}
- if (!t_changePhase.trim().toLowerCase().equals("none")) {
- AllZone.getPhase().setDevPhaseState(t_changePhase);
+ if (!tChangePhase.trim().toLowerCase().equals("none")) {
+ AllZone.getPhase().setDevPhaseState(tChangePhase);
}
- if (!t_humanSetupCardsInPlay.trim().toLowerCase().equals("none")) {
- humanDevSetup = devProcessCardsForZone(humanSetupCardsInPlay, AllZone.getHumanPlayer());
+ if (!tHumanSetupCardsInPlay.trim().toLowerCase().equals("none")) {
+ humanDevSetup = GuiDisplayUtil.devProcessCardsForZone(humanSetupCardsInPlay, AllZone.getHumanPlayer());
}
- if (!t_humanSetupCardsInHand.trim().toLowerCase().equals("none")) {
- humanDevHandSetup = devProcessCardsForZone(humanSetupCardsInHand, AllZone.getHumanPlayer());
+ if (!tHumanSetupCardsInHand.trim().toLowerCase().equals("none")) {
+ humanDevHandSetup = GuiDisplayUtil.devProcessCardsForZone(humanSetupCardsInHand, AllZone.getHumanPlayer());
}
- if (!t_computerSetupCardsInPlay.trim().toLowerCase().equals("none")) {
- computerDevSetup = devProcessCardsForZone(computerSetupCardsInPlay, AllZone.getComputerPlayer());
+ if (!tComputerSetupCardsInPlay.trim().toLowerCase().equals("none")) {
+ computerDevSetup = GuiDisplayUtil.devProcessCardsForZone(computerSetupCardsInPlay,
+ AllZone.getComputerPlayer());
}
- if (!t_computerSetupCardsInHand.trim().toLowerCase().equals("none")) {
- computerDevHandSetup = devProcessCardsForZone(computerSetupCardsInHand, AllZone.getComputerPlayer());
+ if (!tComputerSetupCardsInHand.trim().toLowerCase().equals("none")) {
+ computerDevHandSetup = GuiDisplayUtil.devProcessCardsForZone(computerSetupCardsInHand,
+ AllZone.getComputerPlayer());
}
- if (!t_computerSetupGraveyard.trim().toLowerCase().equals("none")) {
- computerDevGraveyardSetup = devProcessCardsForZone(computerSetupGraveyard, AllZone.getComputerPlayer());
+ if (!tComputerSetupGraveyard.trim().toLowerCase().equals("none")) {
+ computerDevGraveyardSetup = GuiDisplayUtil.devProcessCardsForZone(computerSetupGraveyard,
+ AllZone.getComputerPlayer());
}
- if (!t_humanSetupGraveyard.trim().toLowerCase().equals("none")) {
- humanDevGraveyardSetup = devProcessCardsForZone(humanSetupGraveyard, AllZone.getHumanPlayer());
+ if (!tHumanSetupGraveyard.trim().toLowerCase().equals("none")) {
+ humanDevGraveyardSetup = GuiDisplayUtil.devProcessCardsForZone(humanSetupGraveyard,
+ AllZone.getHumanPlayer());
}
- if (!t_humanSetupLibrary.trim().toLowerCase().equals("none")) {
- humanDevLibrarySetup = devProcessCardsForZone(humanSetupLibrary, AllZone.getHumanPlayer());
+ if (!tHumanSetupLibrary.trim().toLowerCase().equals("none")) {
+ humanDevLibrarySetup = GuiDisplayUtil.devProcessCardsForZone(humanSetupLibrary, AllZone.getHumanPlayer());
}
- if (!t_computerSetupLibrary.trim().toLowerCase().equals("none")) {
- computerDevLibrarySetup = devProcessCardsForZone(computerSetupLibrary, AllZone.getComputerPlayer());
+ if (!tComputerSetupLibrary.trim().toLowerCase().equals("none")) {
+ computerDevLibrarySetup = GuiDisplayUtil.devProcessCardsForZone(computerSetupLibrary,
+ AllZone.getComputerPlayer());
}
- if (!t_humanSetupExile.trim().toLowerCase().equals("none")) {
- humanDevExileSetup = devProcessCardsForZone(humanSetupExile, AllZone.getHumanPlayer());
+ if (!tHumanSetupExile.trim().toLowerCase().equals("none")) {
+ humanDevExileSetup = GuiDisplayUtil.devProcessCardsForZone(humanSetupExile, AllZone.getHumanPlayer());
}
- if (!t_computerSetupExile.trim().toLowerCase().equals("none")) {
- computerDevExileSetup = devProcessCardsForZone(computerSetupExile, AllZone.getComputerPlayer());
+ if (!tComputerSetupExile.trim().toLowerCase().equals("none")) {
+ computerDevExileSetup = GuiDisplayUtil.devProcessCardsForZone(computerSetupExile,
+ AllZone.getComputerPlayer());
}
AllZone.getTriggerHandler().suppressMode("ChangesZone");
AllZone.getCombat().reset();
- for (Card c : humanDevSetup) {
+ for (final Card c : humanDevSetup) {
AllZone.getHumanPlayer().getZone(Zone.Hand).add(c);
AllZone.getGameAction().moveToPlay(c);
c.setSickness(false);
}
- for (Card c : computerDevSetup) {
+ for (final Card c : computerDevSetup) {
AllZone.getComputerPlayer().getZone(Zone.Hand).add(c);
AllZone.getGameAction().moveToPlay(c);
c.setSickness(false);
@@ -1457,22 +1467,22 @@ public final class GuiDisplayUtil implements NewConstants {
* @return a {@link forge.CardList} object.
*/
public static CardList devProcessCardsForZone(final String[] data, final Player player) {
- CardList cl = new CardList();
- for (int i = 0; i < data.length; i++) {
- String[] cardinfo = data[i].trim().split("\\|");
+ final CardList cl = new CardList();
+ for (final String element : data) {
+ final String[] cardinfo = element.trim().split("\\|");
- Card c = AllZone.getCardFactory().getCard(cardinfo[0], player);
+ final Card c = AllZone.getCardFactory().getCard(cardinfo[0], player);
boolean hasSetCurSet = false;
- for (String info : cardinfo) {
+ for (final String info : cardinfo) {
if (info.startsWith("Set:")) {
c.setCurSetCode(info.substring(info.indexOf(':') + 1));
hasSetCurSet = true;
} else if (info.equalsIgnoreCase("Tapped:True")) {
c.tap();
} else if (info.startsWith("Counters:")) {
- String[] counterStrings = info.substring(info.indexOf(':') + 1).split(",");
- for (String counter : counterStrings) {
+ final String[] counterStrings = info.substring(info.indexOf(':') + 1).split(",");
+ for (final String counter : counterStrings) {
c.addCounter(Counters.valueOf(counter), 1);
}
} else if (info.equalsIgnoreCase("SummonSick:True")) {
@@ -1516,12 +1526,12 @@ public final class GuiDisplayUtil implements NewConstants {
* @since 1.0.15
*/
public static void devModeTutor() {
- CardList lib = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
- Object o = GuiUtils.getChoiceOptional("Choose a card", lib.toArray());
+ final CardList lib = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
+ final Object o = GuiUtils.getChoiceOptional("Choose a card", lib.toArray());
if (null == o) {
return;
} else {
- Card c = (Card) o;
+ final Card c = (Card) o;
AllZone.getGameAction().moveToHand(c);
}
}
@@ -1534,21 +1544,21 @@ public final class GuiDisplayUtil implements NewConstants {
* @since 1.0.15
*/
public static void devModeAddCounter() {
- CardList play = AllZoneUtil.getCardsIn(Zone.Battlefield);
- Object o = GuiUtils.getChoiceOptional("Add counters to which card?", play.toArray());
+ final CardList play = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final Object o = GuiUtils.getChoiceOptional("Add counters to which card?", play.toArray());
if (null == o) {
return;
} else {
- Card c = (Card) o;
- Counters counter = GuiUtils.getChoiceOptional("Which type of counter?", Counters.values());
+ final Card c = (Card) o;
+ final Counters counter = GuiUtils.getChoiceOptional("Which type of counter?", Counters.values());
if (null == counter) {
return;
} else {
- Integer[] integers = new Integer[99];
+ final Integer[] integers = new Integer[99];
for (int j = 0; j < 99; j++) {
integers[j] = Integer.valueOf(j);
}
- Integer i = GuiUtils.getChoiceOptional("How many counters?", integers);
+ final Integer i = GuiUtils.getChoiceOptional("How many counters?", integers);
if (null == i) {
return;
} else {
@@ -1566,12 +1576,12 @@ public final class GuiDisplayUtil implements NewConstants {
* @since 1.0.15
*/
public static void devModeTapPerm() {
- CardList play = AllZoneUtil.getCardsIn(Zone.Battlefield);
- Object o = GuiUtils.getChoiceOptional("Choose a permanent", play.toArray());
+ final CardList play = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final Object o = GuiUtils.getChoiceOptional("Choose a permanent", play.toArray());
if (null == o) {
return;
} else {
- Card c = (Card) o;
+ final Card c = (Card) o;
c.tap();
}
}
@@ -1584,12 +1594,12 @@ public final class GuiDisplayUtil implements NewConstants {
* @since 1.0.15
*/
public static void devModeUntapPerm() {
- CardList play = AllZoneUtil.getCardsIn(Zone.Battlefield);
- Object o = GuiUtils.getChoiceOptional("Choose a permanent", play.toArray());
+ final CardList play = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final Object o = GuiUtils.getChoiceOptional("Choose a permanent", play.toArray());
if (null == o) {
return;
} else {
- Card c = (Card) o;
+ final Card c = (Card) o;
c.untap();
}
}
@@ -1613,17 +1623,17 @@ public final class GuiDisplayUtil implements NewConstants {
* @since 1.1.3
*/
public static void devModeSetLife() {
- List players = AllZone.getPlayersInGame();
- Object o = GuiUtils.getChoiceOptional("Set life for which player?", players.toArray());
+ final List players = AllZone.getPlayersInGame();
+ final Object o = GuiUtils.getChoiceOptional("Set life for which player?", players.toArray());
if (null == o) {
return;
} else {
- Player p = (Player) o;
- Integer[] integers = new Integer[99];
+ final Player p = (Player) o;
+ final Integer[] integers = new Integer[99];
for (int j = 0; j < 99; j++) {
integers[j] = Integer.valueOf(j);
}
- Integer i = GuiUtils.getChoiceOptional("Set life to what?", integers);
+ final Integer i = GuiUtils.getChoiceOptional("Set life to what?", integers);
if (null == i) {
return;
} else {
diff --git a/src/main/java/forge/Gui_DownloadPictures_LQ.java b/src/main/java/forge/Gui_DownloadPictures_LQ.java
index b02402cb920..9f3a1c30c2f 100644
--- a/src/main/java/forge/Gui_DownloadPictures_LQ.java
+++ b/src/main/java/forge/Gui_DownloadPictures_LQ.java
@@ -46,7 +46,7 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
String base = ForgeProps.getFile(IMAGE_BASE).getPath();
for (Card c : AllZone.getCardFactory()) {
- if(c.getName().equals("Gatstaf Shepherd")) {
+ if (c.getName().equals("Gatstaf Shepherd")) {
System.out.println("Heyo!");
}
cList.addAll(createDLObjects(c, base));
@@ -89,14 +89,14 @@ public class Gui_DownloadPictures_LQ extends GuiDownloader {
ArrayList ret = new ArrayList();
String url = c.getSVar("Picture");
- String[] URLs = url.split("\\\\");
+ String[] urls = url.split("\\\\");
String iName = GuiDisplayUtil.cleanString(c.getImageName());
- ret.add(new DownloadObject(iName + ".jpg", URLs[0], base));
+ ret.add(new DownloadObject(iName + ".jpg", urls[0], base));
- if (URLs.length > 1) {
- for (int j = 1; j < URLs.length; j++) {
- ret.add(new DownloadObject(iName + j + ".jpg", URLs[j], base));
+ if (urls.length > 1) {
+ for (int j = 1; j < urls.length; j++) {
+ ret.add(new DownloadObject(iName + j + ".jpg", urls[j], base));
}
}
diff --git a/src/main/java/forge/Gui_DownloadSetPictures_LQ.java b/src/main/java/forge/Gui_DownloadSetPictures_LQ.java
index 34b4a0d66c7..9933fb45b73 100644
--- a/src/main/java/forge/Gui_DownloadSetPictures_LQ.java
+++ b/src/main/java/forge/Gui_DownloadSetPictures_LQ.java
@@ -49,25 +49,24 @@ public class Gui_DownloadSetPictures_LQ extends GuiDownloader {
ArrayList cList = new ArrayList();
File base = ForgeProps.getFile(IMAGE_BASE);
- String URLBase = "http://cardforge.org/fpics/";
+ String urlBase = "http://cardforge.org/fpics/";
for (CardPrinted c : CardDb.instance().getAllCards()) {
- String SC3 = c.getSet();
- if (StringUtils.isBlank(SC3) || "???".equals(SC3))
- {
+ String setCode3 = c.getSet();
+ if (StringUtils.isBlank(setCode3) || "???".equals(setCode3)) {
continue; // we don't want cards from unknown sets
}
- CardSet thisSet = SetUtils.getSetByCode(SC3);
- String SC2 = thisSet.getCode2();
+ CardSet thisSet = SetUtils.getSetByCode(setCode3);
+ String setCode2 = thisSet.getCode2();
String imgFN = CardUtil.buildFilename(c);
- boolean foundSetImage = imgFN.contains(SC3) || imgFN.contains(SC2);
+ boolean foundSetImage = imgFN.contains(setCode3) || imgFN.contains(setCode2);
if (!foundSetImage) {
- int artsCnt = c.getCard().getSetInfo(SC3).getCopiesCount();
+ int artsCnt = c.getCard().getSetInfo(setCode3).getCopiesCount();
String fn = CardUtil.buildIdealFilename(c.getName(), c.getArtIndex(), artsCnt);
- cList.add(new DownloadObject(fn, URLBase + SC2 + "/" + Base64Coder.encodeString(fn, true), base
- .getPath() + File.separator + SC3));
+ cList.add(new DownloadObject(fn, urlBase + setCode2 + "/" + Base64Coder.encodeString(fn, true), base
+ .getPath() + File.separator + setCode3));
}
}
diff --git a/src/main/java/forge/Gui_MigrateLocalMWSSetPictures_HQ.java b/src/main/java/forge/Gui_MigrateLocalMWSSetPictures_HQ.java
index 1275376b878..4b6f279e23c 100644
--- a/src/main/java/forge/Gui_MigrateLocalMWSSetPictures_HQ.java
+++ b/src/main/java/forge/Gui_MigrateLocalMWSSetPictures_HQ.java
@@ -1,9 +1,5 @@
package forge;
-import static java.lang.Integer.parseInt;
-import static javax.swing.JOptionPane.DEFAULT_OPTION;
-import static javax.swing.JOptionPane.PLAIN_MESSAGE;
-
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
@@ -41,6 +37,7 @@ import com.esotericsoftware.minlog.Log;
import forge.error.ErrorViewer;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
+import forge.properties.NewConstants.LANG.Gui_DownloadPictures;
//import java.io.BufferedReader;
//import java.io.FileReader;
@@ -55,29 +52,29 @@ import forge.properties.NewConstants;
* @author Forge
* @version $Id$
*/
-public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRangeModel implements Runnable, NewConstants,
- NewConstants.LANG.Gui_DownloadPictures {
+public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRangeModel implements Runnable,
+ NewConstants, NewConstants.LANG.Gui_DownloadPictures {
/** Constant serialVersionUID=-7890794857949935256L. */
private static final long serialVersionUID = -7890794857949935256L;
/** Constant types. */
- public static final Proxy.Type[] types = Proxy.Type.values();
+ public static final Proxy.Type[] TYPES = Proxy.Type.values();
// proxy
private int type;
- private JTextField addr, port;
+ private final JTextField addr, port;
// progress
- private mCard[] cards;
+ private final MCard[] cards;
private int card;
private boolean cancel;
- private JProgressBar bar;
+ private final JProgressBar bar;
- private JOptionPane dlg;
- private JButton close;
+ private final JOptionPane dlg;
+ private final JButton close;
- private long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ private final long[] times = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
private int tptr = 0;
private long lTime = System.currentTimeMillis();
@@ -92,23 +89,23 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
int aTime = 0;
int nz = 10;
- if (tptr > 9) {
- tptr = 0;
+ if (this.tptr > 9) {
+ this.tptr = 0;
}
- times[tptr] = System.currentTimeMillis() - lTime;
- lTime = System.currentTimeMillis();
+ this.times[this.tptr] = System.currentTimeMillis() - this.lTime;
+ this.lTime = System.currentTimeMillis();
int tTime = 0;
for (int i = 0; i < 10; i++) {
- tTime += times[i];
- if (times[i] == 0) {
+ tTime += this.times[i];
+ if (this.times[i] == 0) {
nz--;
}
}
aTime = tTime / nz;
- tptr++;
+ this.tptr++;
return aTime;
}
@@ -120,23 +117,24 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
*
* @param c
* an array of
- * {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.mCard} objects.
+ * {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.MCard} objects.
*/
- private Gui_MigrateLocalMWSSetPictures_HQ(final mCard[] c) {
+ private Gui_MigrateLocalMWSSetPictures_HQ(final MCard[] c) {
this.cards = c;
- addr = new JTextField(ForgeProps.getLocalized(PROXY_ADDRESS));
- port = new JTextField(ForgeProps.getLocalized(PROXY_PORT));
- bar = new JProgressBar(this);
+ this.addr = new JTextField(ForgeProps.getLocalized(Gui_DownloadPictures.PROXY_ADDRESS));
+ this.port = new JTextField(ForgeProps.getLocalized(Gui_DownloadPictures.PROXY_PORT));
+ this.bar = new JProgressBar(this);
- JPanel p0 = new JPanel();
+ final JPanel p0 = new JPanel();
p0.setLayout(new BoxLayout(p0, BoxLayout.Y_AXIS));
// Proxy Choice
- ButtonGroup bg = new ButtonGroup();
- String[] labels = { ForgeProps.getLocalized(NO_PROXY), ForgeProps.getLocalized(HTTP_PROXY),
- ForgeProps.getLocalized(SOCKS_PROXY) };
- for (int i = 0; i < types.length; i++) {
- JRadioButton rb = new JRadioButton(labels[i]);
+ final ButtonGroup bg = new ButtonGroup();
+ final String[] labels = { ForgeProps.getLocalized(Gui_DownloadPictures.NO_PROXY),
+ ForgeProps.getLocalized(Gui_DownloadPictures.HTTP_PROXY),
+ ForgeProps.getLocalized(Gui_DownloadPictures.SOCKS_PROXY) };
+ for (int i = 0; i < Gui_MigrateLocalMWSSetPictures_HQ.TYPES.length; i++) {
+ final JRadioButton rb = new JRadioButton(labels[i]);
rb.addChangeListener(new ProxyHandler(i));
bg.add(rb);
p0.add(rb);
@@ -146,8 +144,8 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
}
// Proxy config
- p0.add(addr);
- p0.add(port);
+ p0.add(this.addr);
+ p0.add(this.port);
// JTextField[] tfs = {addr, port};
// String[] labels = {"Address", "Port"};
// for(int i = 0; i < labels.length; i++) {
@@ -161,6 +159,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
final JButton b = new JButton("Start copying");
b.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent e) {
new Thread(Gui_MigrateLocalMWSSetPictures_HQ.this).start();
b.setEnabled(false);
@@ -171,19 +170,21 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
p0.add(Box.createVerticalStrut(5));
// Progress
- p0.add(bar);
- bar.setStringPainted(true);
+ p0.add(this.bar);
+ this.bar.setStringPainted(true);
// bar.setString(ForgeProps.getLocalized(BAR_BEFORE_START));
- bar.setString(card + "/" + cards.length);
+ this.bar.setString(this.card + "/" + this.cards.length);
// bar.setString(String.format(ForgeProps.getLocalized(card ==
// cards.length? BAR_CLOSE:BAR_WAIT), this.card, cards.length));
- Dimension d = bar.getPreferredSize();
+ final Dimension d = this.bar.getPreferredSize();
d.width = 300;
- bar.setPreferredSize(d);
+ this.bar.setPreferredSize(d);
// JOptionPane
- Object[] options = { b, close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL)) };
- dlg = new JOptionPane(p0, DEFAULT_OPTION, PLAIN_MESSAGE, null, options, options[1]);
+ this.close = new JButton(ForgeProps.getLocalized(BUTTONS.CANCEL));
+ final Object[] options = { b, this.close };
+ this.dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION,
+ JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
}
/** {@inheritDoc} */
@@ -195,7 +196,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
/** {@inheritDoc} */
@Override
public int getValue() {
- return card;
+ return this.card;
}
/** {@inheritDoc} */
@@ -207,7 +208,7 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
/** {@inheritDoc} */
@Override
public int getMaximum() {
- return cards == null ? 0 : cards.length;
+ return this.cards == null ? 0 : this.cards.length;
}
/**
@@ -221,24 +222,40 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
private void update(final int card) {
this.card = card;
+ /**
+ *
+ * TODO: Write javadoc for this type.
+ *
+ */
final class Worker implements Runnable {
- private int card;
+ private final int card;
+ /**
+ *
+ * TODO: Write javadoc for Constructor.
+ *
+ * @param card
+ * int
+ */
Worker(final int card) {
this.card = card;
}
+ /**
+ *
+ */
+ @Override
public void run() {
- fireStateChanged();
+ Gui_MigrateLocalMWSSetPictures_HQ.this.fireStateChanged();
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
- int a = getAverageTimePerCard();
+ final int a = Gui_MigrateLocalMWSSetPictures_HQ.this.getAverageTimePerCard();
- if (card != cards.length) {
- sb.append(card + "/" + cards.length + " - ");
+ if (this.card != Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length) {
+ sb.append(this.card + "/" + Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length + " - ");
- long t2Go = (cards.length - card) * a;
+ long t2Go = (Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length - this.card) * a;
boolean secOnly = true;
if (t2Go > 3600000) {
@@ -257,14 +274,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
sb.append(String.format("0:%02d remaining.", t2Go / 1000));
}
} else {
- sb.append(String.format(ForgeProps.getLocalized(BAR_CLOSE), card, cards.length));
+ sb.append(String.format(ForgeProps.getLocalized(Gui_DownloadPictures.BAR_CLOSE), this.card,
+ Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length));
}
- bar.setString(sb.toString());
+ Gui_MigrateLocalMWSSetPictures_HQ.this.bar.setString(sb.toString());
// bar.setString(String.format(ForgeProps.getLocalized(card ==
// cards.length? BAR_CLOSE:BAR_WAIT), card,
// cards.length));
- System.out.println(card + "/" + cards.length + " - " + a);
+ System.out.println(this.card + "/" + Gui_MigrateLocalMWSSetPictures_HQ.this.cards.length + " - " + a);
}
}
EventQueue.invokeLater(new Worker(card));
@@ -280,8 +298,9 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* @return a {@link javax.swing.JDialog} object.
*/
public JDialog getDlg(final JFrame frame) {
- final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(TITLE));
- close.addActionListener(new ActionListener() {
+ final JDialog dlg = this.dlg.createDialog(frame, ForgeProps.getLocalized(Gui_DownloadPictures.TITLE));
+ this.close.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(final ActionEvent e) {
dlg.setVisible(false);
}
@@ -306,23 +325,25 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* run.
*
*/
+ @Override
public void run() {
BufferedInputStream in;
BufferedOutputStream out;
- File base = ForgeProps.getFile(IMAGE_BASE);
+ File base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
// Random r = MyRandom.random;
Proxy p = null;
- if (type == 0) {
+ if (this.type == 0) {
p = Proxy.NO_PROXY;
} else {
try {
- p = new Proxy(types[type], new InetSocketAddress(addr.getText(), parseInt(port.getText())));
- } catch (Exception ex) {
- ErrorViewer
- .showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), addr.getText(), port.getText());
+ p = new Proxy(Gui_MigrateLocalMWSSetPictures_HQ.TYPES[this.type], new InetSocketAddress(
+ this.addr.getText(), Integer.parseInt(this.port.getText())));
+ } catch (final Exception ex) {
+ ErrorViewer.showError(ex, ForgeProps.getLocalized(ERRORS.PROXY_CONNECT), this.addr.getText(),
+ this.port.getText());
// throw new
// RuntimeException("Gui_DownloadPictures : error 1 - " +ex);
return;
@@ -330,29 +351,29 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
}
if (p != null) {
- byte[] buf = new byte[1024];
+ final byte[] buf = new byte[1024];
int len;
System.out.println("basedir: " + base);
- for (update(0); card < cards.length && !cancel; update(card + 1)) {
+ for (this.update(0); (this.card < this.cards.length) && !this.cancel; this.update(this.card + 1)) {
try {
- String url = cards[card].url;
+ final String url = this.cards[this.card].url;
String cName;
- if (cards[card].name.substring(0, 3).equals("[T]")) {
- base = ForgeProps.getFile(IMAGE_TOKEN);
- cName = cards[card].name.substring(3, cards[card].name.length());
+ if (this.cards[this.card].name.substring(0, 3).equals("[T]")) {
+ base = ForgeProps.getFile(NewConstants.IMAGE_TOKEN);
+ cName = this.cards[this.card].name.substring(3, this.cards[this.card].name.length());
} else {
- base = ForgeProps.getFile(IMAGE_BASE);
- cName = cards[card].name;
+ base = ForgeProps.getFile(NewConstants.IMAGE_BASE);
+ cName = this.cards[this.card].name;
}
- File f = new File(base, cName);
+ final File f = new File(base, cName);
// test for folder existence
- File test = new File(base, cards[card].folder);
+ final File test = new File(base, this.cards[this.card].folder);
if (!test.exists()) {
// create folder
if (!test.mkdir()) {
- System.out.println("Can't create folder" + cards[card].folder);
+ System.out.println("Can't create folder" + this.cards[this.card].folder);
}
}
@@ -360,15 +381,15 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
// in = new BufferedInputStream(new
// URL(url).openConnection(p).getInputStream());
- File src = new File(url);
- InputStream in2 = new FileInputStream(src);
+ final File src = new File(url);
+ final InputStream in2 = new FileInputStream(src);
in = new BufferedInputStream(in2);
out = new BufferedOutputStream(new FileOutputStream(f));
while ((len = in.read(buf)) != -1) {
// user cancelled
- if (cancel) {
+ if (this.cancel) {
in.close();
out.flush();
out.close();
@@ -377,23 +398,23 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
f.delete();
return;
- }// if - cancel
+ } // if - cancel
out.write(buf, 0, len);
- }// while - read and write file
+ } // while - read and write file
in.close();
out.flush();
out.close();
- } catch (MalformedURLException mURLe) {
+ } catch (final MalformedURLException mURLe) {
// System.out.println("Error - possibly missing URL for: "+cards[card].name);
// Log.error("LQ Pictures",
// "Malformed URL for: "+cards[card].name, mURLe);
}
- } catch (FileNotFoundException fnfe) {
- System.out.println("Error - the HQ picture for " + cards[card].name + " could not be found. ["
- + cards[card].url + "] - " + fnfe.getMessage());
- } catch (Exception ex) {
+ } catch (final FileNotFoundException fnfe) {
+ System.out.println("Error - the HQ picture for " + this.cards[this.card].name
+ + " could not be found. [" + this.cards[this.card].url + "] - " + fnfe.getMessage());
+ } catch (final Exception ex) {
Log.error("HQ Pictures", "Error copying pictures", ex);
}
@@ -401,13 +422,13 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
try {
Thread.sleep(1);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
Log.error("HQ Set Pictures", "Sleep Error", e);
}
- }// for
+ } // for
}
- close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE));
- }// run
+ this.close.setText(ForgeProps.getLocalized(BUTTONS.CLOSE));
+ } // run
/**
*
@@ -418,49 +439,49 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* a {@link javax.swing.JFrame} object.
*/
public static void startDownload(final JFrame frame) {
- final mCard[] card = getNeededCards();
+ final MCard[] card = Gui_MigrateLocalMWSSetPictures_HQ.getNeededCards();
if (card.length == 0) {
- JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(NO_MORE));
+ JOptionPane.showMessageDialog(frame, ForgeProps.getLocalized(Gui_DownloadPictures.NO_MORE));
return;
}
- Gui_MigrateLocalMWSSetPictures_HQ download = new Gui_MigrateLocalMWSSetPictures_HQ(card);
- JDialog dlg = download.getDlg(frame);
+ final Gui_MigrateLocalMWSSetPictures_HQ download = new Gui_MigrateLocalMWSSetPictures_HQ(card);
+ final JDialog dlg = download.getDlg(frame);
dlg.setVisible(true);
dlg.dispose();
download.setCancel(true);
- }// startDownload()
+ } // startDownload()
/**
*
* getNeededCards.
*
*
- * @return an array of {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.mCard}
+ * @return an array of {@link forge.Gui_MigrateLocalMWSSetPictures_HQ.MCard}
* objects.
*/
- private static mCard[] getNeededCards() {
+ private static MCard[] getNeededCards() {
// read all card names and urls
// mCard[] cardPlay = readFile(CARD_PICTURES);
// mCard[] cardTokenLQ = readFile(CARD_PICTURES_TOKEN_LQ);
- ArrayList CList = new ArrayList();
+ final ArrayList cList = new ArrayList();
// File imgBase = ForgeProps.getFile(NewConstants.IMAGE_BASE);
- String URLBase = "C:\\MTGForge\\HQPICS\\";
+ final String urlBase = "C:\\MTGForge\\HQPICS\\";
String imgFN = "";
- for (Card c : AllZone.getCardFactory()) {
+ for (final Card c : AllZone.getCardFactory()) {
// String url = c.getSVar("Picture");
// String[] URLs = url.split("\\\\");
- ArrayList cSetInfo = c.getSets();
+ final ArrayList cSetInfo = c.getSets();
if (cSetInfo.size() > 0) {
for (int j = 0; j < cSetInfo.size(); j++) {
c.setCurSetCode(cSetInfo.get(j).Code);
- String SC3 = c.getCurSetCode();
- String SC2 = SetUtils.getCode2ByCode(c.getCurSetCode());
+ final String setCode3 = c.getCurSetCode();
+ final String setCode2 = SetUtils.getCode2ByCode(c.getCurSetCode());
int n = 0;
if (cSetInfo.get(j).PicCount > 0) {
@@ -471,13 +492,13 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
imgFN = CardUtil.buildFilename(c);
- if (imgFN.equals("none") || (!imgFN.contains(SC3) && !imgFN.contains(SC2))) {
+ if (imgFN.equals("none") || (!imgFN.contains(setCode3) && !imgFN.contains(setCode2))) {
imgFN += k + ".jpg";
- String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + k + ".full.jpg";
+ final String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + k + ".full.jpg";
// CList.add(new mCard(SC3 + "/" + fn, URLBase +
// SC2 + "/" + Base64Coder.encodeString(fn,
// true), SC3));
- CList.add(new mCard(SC3 + "\\" + imgFN, URLBase + SC2 + "\\" + fn, SC3));
+ cList.add(new MCard(setCode3 + "\\" + imgFN, urlBase + setCode2 + "\\" + fn, setCode3));
}
}
} else {
@@ -485,17 +506,18 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
imgFN = CardUtil.buildFilename(c);
- if (imgFN.equals("none") || (!imgFN.contains(SC3) && !imgFN.contains(SC2))) {
+ if (imgFN.equals("none") || (!imgFN.contains(setCode3) && !imgFN.contains(setCode2))) {
// imgFN += ".jpg";
- String newFileName = GuiDisplayUtil.cleanString(c.getName()) + ".jpg";
+ final String newFileName = GuiDisplayUtil.cleanString(c.getName()) + ".jpg";
- String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + ".full.jpg";
+ final String fn = GuiDisplayUtil.cleanStringMWS(c.getName()) + ".full.jpg";
// fn = fn.replace(" ", "%20%");
// CList.add(new mCard(SC3 + "/" + fn, URLBase + SC2
// + "/" + Base64Coder.encodeString(fn, true),
// SC3));
- CList.add(new mCard(SC3 + "\\" + newFileName, URLBase + SC2 + "\\" + fn, SC3));
+ cList.add(new MCard(setCode3 + "\\"
+ + newFileName, urlBase + setCode2 + "\\" + fn, setCode3));
}
@@ -517,14 +539,14 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
* if(!file.exists()) CList.add(cardTokenLQ[i]); }
*/
// return all card names and urls that are needed
- mCard[] out = new mCard[CList.size()];
- CList.toArray(out);
+ final MCard[] out = new MCard[cList.size()];
+ cList.toArray(out);
- for (int i = 0; i < out.length; i++) {
- System.out.println(out[i].name + " " + out[i].url);
+ for (final MCard element : out) {
+ System.out.println(element.name + " " + element.url);
}
return out;
- }// getNeededCards()
+ } // getNeededCards()
/*
* private static mCard[] readFile(String ABC) { try { FileReader zrc = new
@@ -547,30 +569,31 @@ public final class Gui_MigrateLocalMWSSetPictures_HQ extends DefaultBoundedRange
*/
private class ProxyHandler implements ChangeListener {
- private int type;
+ private final int type;
public ProxyHandler(final int type) {
this.type = type;
}
+ @Override
public void stateChanged(final ChangeEvent e) {
if (((AbstractButton) e.getSource()).isSelected()) {
- Gui_MigrateLocalMWSSetPictures_HQ.this.type = type;
- addr.setEnabled(type != 0);
- port.setEnabled(type != 0);
+ Gui_MigrateLocalMWSSetPictures_HQ.this.type = this.type;
+ Gui_MigrateLocalMWSSetPictures_HQ.this.addr.setEnabled(this.type != 0);
+ Gui_MigrateLocalMWSSetPictures_HQ.this.port.setEnabled(this.type != 0);
}
}
}
- private static class mCard {
- public final String name;
- public final String url;
- public final String folder;
+ private static class MCard {
+ private final String name;
+ private final String url;
+ private final String folder;
- mCard(final String cardName, final String cardURL, final String cardFolder) {
- name = cardName;
- url = cardURL;
- folder = cardFolder;
+ MCard(final String cardName, final String cardURL, final String cardFolder) {
+ this.name = cardName;
+ this.url = cardURL;
+ this.folder = cardFolder;
}
- }// mCard
+ } // mCard
}
diff --git a/src/main/java/forge/Gui_MultipleBlockers4.java b/src/main/java/forge/Gui_MultipleBlockers4.java
index 65f62907ebd..41b973597b8 100644
--- a/src/main/java/forge/Gui_MultipleBlockers4.java
+++ b/src/main/java/forge/Gui_MultipleBlockers4.java
@@ -23,11 +23,11 @@ import forge.gui.game.CardPanel;
*/
/**
- * very hacky
+ * very hacky.
*
*/
class Gui_MultipleBlockers4 extends JFrame {
- /** Constant serialVersionUID=7622818310877381045L */
+ /** Constant serialVersionUID=7622818310877381045L. */
private static final long serialVersionUID = 7622818310877381045L;
private int assignDamage;
@@ -57,10 +57,11 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param display
* a {@link forge.CardContainer} object.
*/
- Gui_MultipleBlockers4(final Card attacker, final CardList creatureList, final int damage, final CardContainer display) {
+ Gui_MultipleBlockers4(final Card attacker, final CardList creatureList,
+ final int damage, final CardContainer display) {
this();
assignDamage = damage;
- updateDamageLabel();// update user message about assigning damage
+ updateDamageLabel(); // update user message about assigning damage
guiDisplay = display;
att = attacker;
blockers = creatureList;
@@ -120,13 +121,13 @@ class Gui_MultipleBlockers4 extends JFrame {
creaturePanel.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {
- creaturePanel_mousePressed(e);
+ creaturePanelMousePressed(e);
}
});
creaturePanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
@Override
public void mouseMoved(final MouseEvent e) {
- creaturePanel_mouseMoved(e);
+ creaturePanelMouseMoved(e);
}
});
mainPanel.add(jPanel3, null);
@@ -144,7 +145,7 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param e
* a {@link java.awt.event.ActionEvent} object.
*/
- void okButton_actionPerformed(final ActionEvent e) {
+ void okButtonActionPerformed(final ActionEvent e) {
dispose();
}
@@ -156,7 +157,7 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param e
* a {@link java.awt.event.MouseEvent} object.
*/
- void creaturePanel_mousePressed(final MouseEvent e) {
+ void creaturePanelMousePressed(final MouseEvent e) {
Object o = creaturePanel.getComponentAt(e.getPoint());
if (o instanceof CardPanel) {
@@ -198,7 +199,7 @@ class Gui_MultipleBlockers4 extends JFrame {
}
// reduce damage, show new user message, exit if necessary
- }// creaturePanel_mousePressed()
+ } // creaturePanel_mousePressed()
/**
*
@@ -217,7 +218,7 @@ class Gui_MultipleBlockers4 extends JFrame {
* @param e
* a {@link java.awt.event.MouseEvent} object.
*/
- void creaturePanel_mouseMoved(final MouseEvent e) {
+ void creaturePanelMouseMoved(final MouseEvent e) {
Object o = creaturePanel.getComponentAt(e.getPoint());
if (o instanceof CardPanel) {
CardContainer cardPanel = (CardContainer) o;
diff --git a/src/main/java/forge/PlayerZoneComesIntoPlay.java b/src/main/java/forge/PlayerZoneComesIntoPlay.java
index da38e371204..7096053c791 100644
--- a/src/main/java/forge/PlayerZoneComesIntoPlay.java
+++ b/src/main/java/forge/PlayerZoneComesIntoPlay.java
@@ -344,10 +344,10 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
// getCards(false) to get Phased Out cards
Card[] c;
if (!filter) {
- c = new Card[cards.size()];
- cards.toArray(c);
+ c = new Card[getCardList().size()];
+ getCardList().toArray(c);
} else {
- Iterator itr = cards.iterator();
+ Iterator itr = getCardList().iterator();
ArrayList list = new ArrayList();
while (itr.hasNext()) {
Card crd = itr.next();