package org.well.well.AlarmEnumDTO;

/**
 * Created by admin on 2017/4/6.
 */
public enum WasteGasAlarmEnum {

    NO_DATA("设备异常",-1),
    NORMAL("正常",0),
    OVER_THRESH("有害气体超标",3),
    ISOPEN("开关关闭",4),
    CO_OVER_THRESH("一氧化碳超标",5),
    H2S_OVER_THRESH("硫化氢超标",6),
    O2_OVER_THRESH("氧气超标",7),
    CH4_OVER_THRESH("甲烷超标",8),
    CO_OVER_THRESH1("一级一氧化碳超标",9),
    CO_OVER_THRESH2("二级一氧化碳超标",10),
    CO_OVER_THRESH3("三级一氧化碳超标",11),
    H2S_OVER_THRESH1("一级硫化氢超标",12),
    H2S_OVER_THRESH2("二级硫化氢超标",13),
    H2S_OVER_THRESH3("三级硫化氢超标",14),
    O2_OVER_THRESH1("一级氧气超标",15),
    O2_OVER_THRESH2("二级氧气超标",16),
    O2_OVER_THRESH3("三级氧气超标",17),
    CH4_OVER_THRESH1("一级甲烷超标",18),
    CH4_OVER_THRESH2("二级甲烷超标",19),
    CH4_OVER_THRESH3("三级甲烷超标",20);



    // 成员变量
    private String name;
    private int index;
    // 构造方法
    private WasteGasAlarmEnum(String name, int index){
        this.name=name;
        this.index=index;
    }
    public int getIndex(){
        return this.index;
    }
    public String getName(){
        return this.name;
    }
    public static WasteGasAlarmEnum getByIndex(String index) {
        try {
            for (WasteGasAlarmEnum temp : values()) {
                if (temp.index == Integer.parseInt(index)) {
                    return temp;
                }
            }
        } catch (Exception e) {}
        return null;
    }
    //覆盖方法
    @Override
    public String toString(){
        return this.name;
    }
}
