Android Open Source - umpire_buddy Game Stats






From Project

Back to project page umpire_buddy.

License

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.

Java Source Code

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);
  }
}




Java Source Code List

com.bluefairyapps.java.android.umpirebuddy.AboutActivity.java
com.bluefairyapps.java.android.umpirebuddy.MainActivity.java
com.bluefairyapps.java.android.umpirebuddy.enums.EventsEnum.java
com.bluefairyapps.java.android.umpirebuddy.enums.GameStatsEnum.java
com.bluefairyapps.java.android.umpirebuddy.event.EventListener.java
com.bluefairyapps.java.android.umpirebuddy.event.Event.java
com.bluefairyapps.java.android.umpirebuddy.event.game.GameStatUpdateEvent.java
com.bluefairyapps.java.android.umpirebuddy.systems.AudioSystem.java
com.bluefairyapps.java.android.umpirebuddy.systems.BaseballGameSystem.java
com.bluefairyapps.java.android.umpirebuddy.systems.EventManager.java
com.bluefairyapps.java.android.umpirebuddy.utils.BaseballRules.java
com.bluefairyapps.java.android.umpirebuddy.utils.GameStats.java