package org.well.well.AlarmEnumDTO;

public enum H2SAlarmEnum {

    NO_DATA1("设备异常", -1),
    NORMAL("状态正常", 0),
    OVER_THRESH("浓度超限",1),
    H2SAlarmFail("硫化氢探头采集失败",2),
    H2SAlarmError("硫化氢数据异常",3),
    H2SUnknown("硫化氢未知异常",4),
    OVER_THRESH1("一级浓度超限",5),
    OVER_THRESH2("二级浓度超限",6);

    // 成员变量
    private String name;
    private int index;

    // 构造方法
    private H2SAlarmEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public int getIndex() {
        return index;
    }

    public static H2SAlarmEnum getByIndex(String index) {
        try {
            for (H2SAlarmEnum h2SAlarmEnum : values()) {
                if (h2SAlarmEnum.index == Integer.parseInt(index)) {
                    return h2SAlarmEnum;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    //覆盖方法
    @Override
    public String toString() {
        return this.name;
    }

    public String getName() {
        return name;
    }
}