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.event.game; //from ww w . ja va2 s. c om import java.util.HashMap; import java.util.Set; import com.bluefairyapps.java.android.umpirebuddy.enums.EventsEnum; import com.bluefairyapps.java.android.umpirebuddy.enums.GameStatsEnum; import com.bluefairyapps.java.android.umpirebuddy.event.Event; /** * This {@link Event} is dispatched whenever a game stat is updated and carries a list of names * of the updated stats as well as their corresponding new values. * @author Matt Parish */ public class GameStatUpdateEvent extends Event { private HashMap<GameStatsEnum, Integer> mUpdatedStatsMap; /** * <b>public GameStatUpdateEvent()</b><br> * Constructor * @param updatedStats A primitive array of the game stats that have been updated. * @param newValues A primitive array of the new values. */ public GameStatUpdateEvent(GameStatsEnum[] updatedStats, int[] newValues) { super(EventsEnum.EVENT_UPDATE_VIEWS); mUpdatedStatsMap = new HashMap<GameStatsEnum, Integer>(); for(int i=0; i<updatedStats.length; i++) { mUpdatedStatsMap.put(updatedStats[i], newValues[i]); } } /** * Retrieve a list of names of the game stats that have been updated. * @return A {@link Set} of {@link GameStatsEnum} values. */ public Set<GameStatsEnum> getStatsTypeList() { return mUpdatedStatsMap.keySet(); } /** * Retrieve the new value of the specified game stat carried with this event. * @param statType The name of the stat to be retrieved. * @return The new value of the specified stat. */ public int getStat(GameStatsEnum statType) { return mUpdatedStatsMap.get(statType).intValue(); } }