diff --git a/src/main/java/forge/AllZone.java b/src/main/java/forge/AllZone.java
index e40381336af..75f79c2a708 100644
--- a/src/main/java/forge/AllZone.java
+++ b/src/main/java/forge/AllZone.java
@@ -1,6 +1,10 @@
package forge;
+import java.util.Iterator;
+import java.util.Map;
+
+import net.slightlymagic.braids.util.UtilFunctions;
import forge.card.cardFactory.CardFactoryInterface;
import forge.card.cardFactory.PreloadingCardFactory;
import forge.card.mana.ManaPool;
@@ -9,16 +13,10 @@ import forge.deck.DeckManager;
import forge.game.GameSummary;
import forge.gui.input.InputControl;
import forge.model.FGameState;
-import forge.model.FModel;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.data.QuestMatchState;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import net.slightlymagic.braids.util.UtilFunctions;
-
+import forge.quest.data.QuestData;
/**
* Please use public getters and setters instead of direct field access.
@@ -28,44 +26,59 @@ import net.slightlymagic.braids.util.UtilFunctions;
* @author Forge
* @version $Id$
*/
-public class AllZone implements NewConstants {
+public final class AllZone implements NewConstants {
//only for testing, should read decks from local directory
-// public static final IO IO = new IO("all-decks");
+ // public static final IO IO = new IO("all-decks");
+
+ /**
+ * Do not instantiate.
+ */
+ private AllZone() {
+ // blank
+ }
- /** Constant QuestData */
- private static forge.quest.data.QuestData QuestData = null;
- /** Constant QuestAssignment */
- private static Quest_Assignment QuestAssignment = null;
- /** Constant NameChanger */
- private static final NameChanger NameChanger = new NameChanger();
- /** Constant ColorChanger */
- private static final ColorChanger colorChanger = new ColorChanger();
+ /** Global questData. */
+ private static forge.quest.data.QuestData questData = null;
+
+ /** Global QuestAssignment. */
+ private static Quest_Assignment questAssignment = null;
+
+ /** Constant NAME_CHANGER. */
+ private static final NameChanger NAME_CHANGER = new NameChanger();
+
+ /** Constant COLOR_CHANGER. */
+ private static final ColorChanger COLOR_CHANGER = new ColorChanger();
// Phase is now a prerequisite for CardFactory
- /** Constant CardFactory */
+ /** Global cardFactory. */
private static CardFactoryInterface cardFactory = null;
- /** Constant InputControl */
- private static final InputControl InputControl = new InputControl();
-
- /** Game state observer GameSummary collects statistics and players' performance*/
+ /** Constant inputControl. */
+ private static final InputControl INPUT_CONTROL = new InputControl();
+
+ /** Game state observer gameInfo collects statistics and players' performance. */
private static GameSummary gameInfo = new GameSummary();
- /** Match State for quests are stored in a QuestMatchState class instance*/
+
+ /**
+ * Match State for quests are stored in a QuestMatchState class instance.
+ *
+ * @deprecated Variable 'matchState' must be private and have accessor methods.
+ */
public static QuestMatchState matchState = new QuestMatchState();
//initialized at Runtime since it has to be the last object constructed
- /** Constant Computer */
- private static ComputerAI_Input Computer;
+ /** Global computer. */
+ private static ComputerAI_Input computer;
//shared between Input_Attack, Input_Block, Input_CombatDamage , InputState_Computer
- /** Constant Display */
- private static Display Display;
+ /** Global display. */
+ private static Display display;
- /** Constant DeckManager */
- private final static DeckManager dMgr = new DeckManager(ForgeProps.getFile(NEW_DECKS));
+ /** Constant DECK_MGR. */
+ private static final DeckManager DECK_MGR = new DeckManager(ForgeProps.getFile(NEW_DECKS));
/**
*
getHumanPlayer.
@@ -104,17 +117,17 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static forge.quest.data.QuestData getQuestData() { - return QuestData; + return questData; } /** *setQuestData.
* - * @param questData a {@link forge.quest.data.QuestData} object. + * @param questData0 a {@link forge.quest.data.QuestData} object. * @since 1.0.15 */ - public static void setQuestData(forge.quest.data.QuestData questData) { - QuestData = questData; + public static void setQuestData(final QuestData questData0) { + questData = questData0; } /** @@ -124,7 +137,7 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static Quest_Assignment getQuestAssignment() { - return QuestAssignment; + return questAssignment; } /** @@ -133,8 +146,8 @@ public class AllZone implements NewConstants { * @param assignment a {@link forge.Quest_Assignment} object. * @since 1.0.15 */ - public static void setQuestAssignment(Quest_Assignment assignment) { - QuestAssignment = assignment; + public static void setQuestAssignment(final Quest_Assignment assignment) { + questAssignment = assignment; } /** @@ -144,7 +157,7 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static NameChanger getNameChanger() { - return NameChanger; + return NAME_CHANGER; } /** @@ -208,18 +221,22 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static CardFactoryInterface getCardFactory() { - if (cardFactory == null) { - setCardFactory(new PreloadingCardFactory(ForgeProps.getFile(CARDSFOLDER))); - } + if (cardFactory == null) { + setCardFactory(new PreloadingCardFactory(ForgeProps.getFile(CARDSFOLDER))); + } return cardFactory; } - public static void setCardFactory(CardFactoryInterface factory) { - UtilFunctions.checkNotNull("factory", factory); - cardFactory = factory; - } + /** + * Setter for cardFactory. + * @param factory the factory to set + */ + public static void setCardFactory(final CardFactoryInterface factory) { + UtilFunctions.checkNotNull("factory", factory); + cardFactory = factory; + } - /** + /** *getStack.
* * Will eventually be marked deprecated. @@ -244,7 +261,7 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static InputControl getInputControl() { - return InputControl; + return INPUT_CONTROL; } /** @@ -312,7 +329,7 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static ComputerAI_Input getComputer() { - return Computer; + return computer; } /** @@ -321,8 +338,8 @@ public class AllZone implements NewConstants { * @param input a {@link forge.ComputerAI_Input} object. * @since 1.0.15 */ - public static void setComputer(ComputerAI_Input input) { - Computer = input; + public static void setComputer(final ComputerAI_Input input) { + computer = input; } /** @@ -345,11 +362,10 @@ public class AllZone implements NewConstants { * @param attackers a {@link forge.Combat} object. * @since 1.0.15 */ - public static void setCombat(Combat attackers) { + public static void setCombat(final Combat attackers) { Singletons.getModel().getGameState().setCombat(attackers); } - //Human_Play, Computer_Play is different because Card.comesIntoPlay() is called when a card is added by PlayerZone.add(Card) /** *getHumanBattlefield.
* @@ -523,7 +539,7 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static ManaPool getComputerManaPool() { - return AllZone.getComputerPlayer().getManaPool(); + return AllZone.getComputerPlayer().getManaPool(); } /** @@ -533,17 +549,17 @@ public class AllZone implements NewConstants { * @since 1.0.15 */ public static Display getDisplay() { - return Display; + return display; } /** *setDisplay.
* - * @param display a {@link forge.Display} object. + * @param display0 a {@link forge.Display} object. * @since 1.0.15 */ - public static void setDisplay(Display display) { - Display = display; + public static void setDisplay(final Display display0) { + display = display0; } /** @@ -563,14 +579,15 @@ public class AllZone implements NewConstants { * @param c a {@link forge.Card} object. * @return a {@link forge.PlayerZone} object. */ - public static PlayerZone getZone(Card c) { + public static PlayerZone getZone(final Card c) { IteratorgetZone.
* * @param zone a {@link java.lang.String} object. - * @param player a {@link forge.Player} object. + * @param finalPlayer a {@link forge.Player} object. * @return a {@link forge.PlayerZone} object. */ - public static PlayerZone getZone(String zone, Player player) { - if (zone.equals("Stack")) player = null; + public static PlayerZone getZone(final String zone, final Player finalPlayer) { + Player player; + if (zone.equals("Stack")) { + player = null; + } + else { + player = finalPlayer; + } + Object o = getMap().get(zone + player); - if (o == null) + + if (o == null) { throw new RuntimeException("AllZone : getZone() invalid parameters " + zone + " " + player); + } return (PlayerZone) o; } @@ -606,12 +632,13 @@ public class AllZone implements NewConstants { ((DefaultPlayerZone) getComputerBattlefield()).resetCardsAddedThisTurn(); ((DefaultPlayerZone) getComputerGraveyard()).resetCardsAddedThisTurn(); } - + /** - *getDeckManager.
+ *getDeckManager.
+ * @return dMgr */ public static DeckManager getDeckManager() { - return dMgr; + return DECK_MGR; } /** @@ -622,11 +649,11 @@ public class AllZone implements NewConstants { * @return the next timestamp */ public static long getNextTimestamp() { - return Singletons.getModel().getGameState().getNextTimestamp(); + return Singletons.getModel().getGameState().getNextTimestamp(); } - + /** - *Resets everything possible to set a new game
+ *Resets everything possible to set a new game.
*/ public static void newGameCleanup() { @@ -661,17 +688,24 @@ public class AllZone implements NewConstants { // player.reset() now handles this //AllZone.getHumanPlayer().clearHandSizeOperations(); //AllZone.getComputerPlayer().clearHandSizeOperations(); - + getTriggerHandler().clearRegistered(); } + /** + * Getter for matchState. + * @return the matchState + */ public static QuestMatchState getMatchState() { return matchState; } + /** + * Getter for colorChanger. + * @return the colorChanger + */ public static ColorChanger getColorChanger() { - // TODO Auto-generated method stub - return colorChanger; + return COLOR_CHANGER; } -}//AllZone +} //AllZone