Back to project page umpire_buddy.
The source code is released under:
Apache License
If you think the Android project umpire_buddy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.bluefairyapps.java.android.umpirebuddy.utils; //from www . j av a2s .com import java.util.HashMap; import com.bluefairyapps.java.android.umpirebuddy.enums.GameStatsEnum; public class GameStats { @SuppressWarnings("unused") private static final String TAG = GameStats.class.getSimpleName(); private HashMap<GameStatsEnum, Integer> mStats; public GameStats() { mStats = new HashMap<GameStatsEnum, Integer>(); resetAll(); } public void reset(GameStatsEnum stat) { switch(stat) { case STRIKES: mStats.put(GameStatsEnum.STRIKES, BaseballRules.INIT_STRIKES); break; case BALLS: mStats.put(GameStatsEnum.BALLS, BaseballRules.INIT_BALLS); break; case OUTS: mStats.put(GameStatsEnum.OUTS, BaseballRules.INIT_OUTS); break; case INNING: mStats.put(GameStatsEnum.INNING, BaseballRules.INIT_INNING); break; default: break; } } public void resetAll() { mStats.put(GameStatsEnum.STRIKES, BaseballRules.INIT_STRIKES); mStats.put(GameStatsEnum.BALLS, BaseballRules.INIT_BALLS); mStats.put(GameStatsEnum.OUTS, BaseballRules.INIT_OUTS); mStats.put(GameStatsEnum.INNING, BaseballRules.INIT_INNING); } public int getStat(GameStatsEnum stat) { switch(stat) { case STRIKES: return mStats.get(GameStatsEnum.STRIKES); case BALLS: return mStats.get(GameStatsEnum.BALLS); case OUTS: return mStats.get(GameStatsEnum.OUTS); case INNING: return mStats.get(GameStatsEnum.INNING); default: return -1; } } public void updateStat(GameStatsEnum stat, int newValue) { mStats.put(stat, newValue); } }