Android Open Source - ShadowCraft_Android Procs List






From Project

Back to project page ShadowCraft_Android.

License

The source code is released under:

GNU General Public License

If you think the Android project ShadowCraft_Android 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 classes;
// ww  w. ja v a 2 s .  c o  m
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import core.InvalidInputException;

/**
 * Proc container. Instantiates procs and defines methods to filter them.
 */
public class ProcsList {

    @SuppressWarnings("serial")
    class InvalidProcException extends InvalidInputException {
        public InvalidProcException(String message) {
            super(message);
        }
    }

    private static final Set<String> allowed_procs = Data.proc_data.keySet();
    private Map<String, Proc> present_procs = new HashMap<String, Proc>();

    public ProcsList(String... args) {
        for (String proc : args) {
            this.append_proc(proc);
        }
    }

    public ProcsList(Set<String> args) {
        for (String proc : args) {
            this.append_proc(proc);
        }
    }

    public HashMap<String, ?> get_proc_data(String arg) throws InvalidProcException {
        if (!allowed_procs().contains(arg))
            throw new InvalidProcException(String.format("No data available for proc %s", arg));
        return Data.proc_data.get(arg);
    }

    public void append_proc(String proc) {
        this.present_procs.put(proc, new Proc(get_proc_data(proc)));
    }

    public Proc get_proc(String proc) {
        return this.present_procs.get(proc);
    }

    public void del_proc(String proc) {
        this.present_procs.remove(proc);
    }

    public boolean exists_proc(String proc) {
        return this.present_procs.containsKey(proc);
    }

    public Set<Proc> get_all_procs_for_stat(String stat) {
        Set<Proc> procs = new HashSet<Proc>();
        for (String proc_name : allowed_procs) {
            Proc proc = get_proc(proc_name);
            if (proc != null && (proc.stat().equals(stat) || stat == null)) {
                procs.add(proc);
            }
        }
        return procs;
    }

    public Set<Proc> get_all_procs_for_stat() {
        return get_all_procs_for_stat(null);
    }

    public Set<Proc> get_all_damage_procs() {
        Set<Proc> procs = new HashSet<Proc>();
        for (String proc_name : allowed_procs) {
            Proc proc = get_proc(proc_name);
            if (proc != null && (proc.stat().equals("spell_damage") || proc.stat().equals("physical_damage")))
                procs.add(proc);
        }
        return procs;
    }

    public static Set<String> allowed_procs() {
        return allowed_procs;
    }

}




Java Source Code List

calcs.ArmorMitigation.java
calcs.DamageCalculator.java
classes.Buffs.java
classes.Data.java
classes.GearBuffs.java
classes.Glyphs.java
classes.Proc.java
classes.ProcsList.java
classes.Race.java
classes.Stats.java
classes.Talents.java
classes.Weapon.java
com.shadowcraft.android.APP.java
com.shadowcraft.android.Bnet.java
com.shadowcraft.android.CharHandler.java
com.shadowcraft.android.DataBaseHelper.java
com.shadowcraft.android.Data.java
com.shadowcraft.android.Gear.java
com.shadowcraft.android.IconHandler.java
com.shadowcraft.android.ItemView.java
com.shadowcraft.android.RogueBackend.java
com.shadowcraft.android.ShadowcraftMain.java
com.shadowcraft.android.Stat.java
com.shadowcraft.android.TalentsData.java
com.shadowcraft.android.Talents.java
core.InvalidInputException.java
core.InvalidLevelException.java
core.util.java
rogue.AldrianasRogueDamageCalculator.java
rogue.Cycle.java
rogue.RogueDamageCalculator.java
rogue.RogueGlyphs.java
rogue.RogueModelerData.java
rogue.RogueTalents.java
rogue.Settings.java