Modified Character.java

mail@pastecode.io avatar
unknown
java
3 years ago
12 kB
7
Indexable
Never
public class Character{
    private String[]abilities;
    private float against_bug;
    private float against_dark;
    private float against_dragon;
    private float against_electric;
    private float against_fairy;
    private float against_fight;
    private float against_fire;
    private float against_flying;
    private float against_ghost;
    private float against_grass;
    private float against_ground;
    private float against_ice;
    private float against_normal;
    private float against_poison;
    private float against_psychic;
    private float against_rock;
    private float against_steel;
    private float against_water;
    private float attack;
    private float base_egg_steps;
    private float base_happiness;
    private float base_total;
    private float capture_rate;
    private String classfication;
    private float defense;
    private float experience_growth;
    private float height_m;
    private float hp;
    private String japanese_name;
    private String name;
    private float percentage_male;
    private float pokedex_number;
    private float sp_attack;
    private float sp_defense;
    private float speed;
    private String type1;
    private String type2;
    private float weight_kg;
    private float generation;
    private boolean is_legendary;


    
    public Character(String dataLine){
        // replace all '' && "" with  ""
        dataLine = dataLine.replaceAll("[\'\"]", "");

        //two part consist of [ first_column , rest_all_column ]
        String two_part[]  =  dataLine.split("],");
      
        String data[] = two_part[1].split(",");
        
        //abilities = Early Bird, Flash Fire, Unnerve
        String abilities = two_part[0].replaceAll("[\'\"\\[\\]]", "");
        
        // now split abilities to make array of string
        this.abilities = abilities.split(", ");
        
        this.against_bug=Float.parseFloat(data[0].equals("")?"0":data[0]);
        this.against_dark=Float.parseFloat(data[1].equals("")?"0":data[1]);
        this.against_dragon=Float.parseFloat(data[2].equals("")?"0":data[2]);
        this.against_electric=Float.parseFloat(data[3].equals("")?"0":data[3]);
        this.against_fairy=Float.parseFloat(data[4].equals("")?"0":data[4]);
        this.against_fight=Float.parseFloat(data[5].equals("")?"0":data[5]);
        this.against_fire=Float.parseFloat(data[6].equals("")?"0":data[6]);
        this.against_flying=Float.parseFloat(data[7].equals("")?"0":data[7]);
        this.against_ghost=Float.parseFloat(data[8].equals("")?"0":data[8]);
        this.against_grass=Float.parseFloat(data[9].equals("")?"0":data[9]);
        this.against_ground=Float.parseFloat(data[10].equals("")?"0":data[10]);
        this.against_ice=Float.parseFloat(data[11].equals("")?"0":data[11]);
        this.against_normal=Float.parseFloat(data[12].equals("")?"0":data[12]);
        this.against_poison=Float.parseFloat(data[13].equals("")?"0":data[13]);
        this.against_psychic=Float.parseFloat(data[14].equals("")?"0":data[14]);
        this.against_rock=Float.parseFloat(data[15].equals("")?"0":data[15]);
        this.against_steel=Float.parseFloat(data[16].equals("")?"0":data[16]);
        this.against_water=Float.parseFloat(data[17].equals("")?"0":data[17]);
        this.attack=Float.parseFloat(data[18].equals("")?"0":data[18]);
        this.base_egg_steps=Float.parseFloat(data[19].equals("")?"0":data[19]);
        this.base_happiness=Float.parseFloat(data[20].equals("")?"0":data[20]);
        this.base_total=Float.parseFloat(data[21].equals("")?"0":data[21]);
        this.capture_rate=Float.parseFloat(data[22].equals("")?"0":data[22]);
        this.classfication=data[23];
        this.defense=Float.parseFloat(data[24].equals("")?"0":data[24]);
        this.experience_growth=Float.parseFloat(data[25].equals("")?"0":data[25]);
        this.height_m=Float.parseFloat(data[26].equals("")?"0":data[26]);
        this.hp=Float.parseFloat(data[27].equals("")?"0":data[27]);
        this.japanese_name=data[28];
        this.name=data[29];
        this.percentage_male=Float.parseFloat(data[30].equals("")?"0":data[30]);
        this.pokedex_number=Float.parseFloat(data[31].equals("")?"0":data[31]);
        this.sp_attack=Float.parseFloat(data[32].equals("")?"0":data[32]);
        this.sp_defense=Float.parseFloat(data[33].equals("")?"0":data[33]);
        this.speed=Float.parseFloat(data[34].equals("")?"0":data[34]);
        this.type1=data[35];
        this.type2=data[36];
        this.weight_kg=Float.parseFloat(data[37].equals("")?"0":data[37]);
        this.generation=Float.parseFloat(data[38].equals("")?"0":data[38]);
        boolean is_legendary = data[39].equals("") ? false : (data[39].equals("0") ? false :true );
        this.is_legendary=is_legendary;
        
    }
    public String[] getAbilities() {
        return abilities;
    }

    public void setAbilities(String[] abilities) {
        this.abilities = abilities;
    }

    public float getAgainst_bug() {
        return against_bug;
    }

    public void setAgainst_bug(float against_bug) {
        this.against_bug = against_bug;
    }

    public float getAgainst_dark() {
        return against_dark;
    }

    public void setAgainst_dark(float against_dark) {
        this.against_dark = against_dark;
    }

    public float getAgainst_dragon() {
        return against_dragon;
    }

    public void setAgainst_dragon(float against_dragon) {
        this.against_dragon = against_dragon;
    }

    public float getAgainst_electric() {
        return against_electric;
    }

    public void setAgainst_electric(float against_electric) {
        this.against_electric = against_electric;
    }

    public float getAgainst_fairy() {
        return against_fairy;
    }

    public void setAgainst_fairy(float against_fairy) {
        this.against_fairy = against_fairy;
    }

    public float getAgainst_fight() {
        return against_fight;
    }

    public void setAgainst_fight(float against_fight) {
        this.against_fight = against_fight;
    }

    public float getAgainst_fire() {
        return against_fire;
    }

    public void setAgainst_fire(float against_fire) {
        this.against_fire = against_fire;
    }

    public float getAgainst_flying() {
        return against_flying;
    }

    public void setAgainst_flying(float against_flying) {
        this.against_flying = against_flying;
    }

    public float getAgainst_ghost() {
        return against_ghost;
    }

    public void setAgainst_ghost(float against_ghost) {
        this.against_ghost = against_ghost;
    }

    public float getAgainst_grass() {
        return against_grass;
    }

    public void setAgainst_grass(float against_grass) {
        this.against_grass = against_grass;
    }

    public float getAgainst_ground() {
        return against_ground;
    }

    public void setAgainst_ground(float against_ground) {
        this.against_ground = against_ground;
    }

    public float getAgainst_ice() {
        return against_ice;
    }

    public void setAgainst_ice(float against_ice) {
        this.against_ice = against_ice;
    }

    public float getAgainst_normal() {
        return against_normal;
    }

    public void setAgainst_normal(float against_normal) {
        this.against_normal = against_normal;
    }

    public float getAgainst_poison() {
        return against_poison;
    }

    public void setAgainst_poison(float against_poison) {
        this.against_poison = against_poison;
    }

    public float getAgainst_psychic() {
        return against_psychic;
    }

    public void setAgainst_psychic(float against_psychic) {
        this.against_psychic = against_psychic;
    }

    public float getAgainst_rock() {
        return against_rock;
    }

    public void setAgainst_rock(float against_rock) {
        this.against_rock = against_rock;
    }

    public float getAgainst_steel() {
        return against_steel;
    }

    public void setAgainst_steel(float against_steel) {
        this.against_steel = against_steel;
    }

    public float getAgainst_water() {
        return against_water;
    }

    public void setAgainst_water(float against_water) {
        this.against_water = against_water;
    }

    public float getAttack() {
        return attack;
    }

    public void setAttack(float attack) {
        this.attack = attack;
    }

    public float getBase_egg_steps() {
        return base_egg_steps;
    }

    public void setBase_egg_steps(float base_egg_steps) {
        this.base_egg_steps = base_egg_steps;
    }

    public float getBase_happiness() {
        return base_happiness;
    }

    public void setBase_happiness(float base_happiness) {
        this.base_happiness = base_happiness;
    }

    public float getBase_total() {
        return base_total;
    }

    public void setBase_total(float base_total) {
        this.base_total = base_total;
    }

    public float getCapture_rate() {
        return capture_rate;
    }

    public void setCapture_rate(float capture_rate) {
        this.capture_rate = capture_rate;
    }

    public String getClassfication() {
        return classfication;
    }

    public void setClassfication(String classfication) {
        this.classfication = classfication;
    }

    public float getDefense() {
        return defense;
    }

    public void setDefense(float defense) {
        this.defense = defense;
    }

    public float getExperience_growth() {
        return experience_growth;
    }

    public void setExperience_growth(float experience_growth) {
        this.experience_growth = experience_growth;
    }

    public float getHeight_m() {
        return height_m;
    }

    public void setHeight_m(float height_m) {
        this.height_m = height_m;
    }

    public float getHp() {
        return hp;
    }

    public void setHp(float hp) {
        this.hp = hp;
    }

    public String getJapanese_name() {
        return japanese_name;
    }

    public void setJapanese_name(String japanese_name) {
        this.japanese_name = japanese_name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public float getPercentage_male() {
        return percentage_male;
    }

    public void setPercentage_male(float percentage_male) {
        this.percentage_male = percentage_male;
    }

    public float getPokedex_number() {
        return pokedex_number;
    }

    public void setPokedex_number(float pokedex_number) {
        this.pokedex_number = pokedex_number;
    }

    public float getSp_attack() {
        return sp_attack;
    }

    public void setSp_attack(float sp_attack) {
        this.sp_attack = sp_attack;
    }

    public float getSp_defense() {
        return sp_defense;
    }

    public void setSp_defense(float sp_defense) {
        this.sp_defense = sp_defense;
    }

    public float getSpeed() {
        return speed;
    }

    public void setSpeed(float speed) {
        this.speed = speed;
    }

    public String getType1() {
        return type1;
    }

    public void setType1(String type1) {
        this.type1 = type1;
    }

    public String getType2() {
        return type2;
    }

    public void setType2(String type2) {
        this.type2 = type2;
    }

    public float getWeight_kg() {
        return weight_kg;
    }

    public void setWeight_kg(float weight_kg) {
        this.weight_kg = weight_kg;
    }

    public float getGeneration() {
        return generation;
    }

    public void setGeneration(float generation) {
        this.generation = generation;
    }

    public boolean isIs_legendary() {
        return is_legendary;
    }

    public void setIs_legendary(boolean is_legendary) {
        this.is_legendary = is_legendary;
    }

    
}