package org.well.well.AlarmEnumDTO;

public enum KadAlarmEnum {
    NO_DATA("设备异常", -1),

    NORMAL("正常", 0),

    OVER_THRESH("燃气超限", 1),

    GCommunicationFailure("可燃气体探测仪通讯失败", 2),

    KadError("可燃气体探测仪传感器异常", 3),

    KadUnknown("可燃气体探测仪未知异常", 4),

    OVER_THRESH1("一级燃气超限", 5),

    OVER_THRESH2("二级燃气超限", 6);

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

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

    public int getIndex() {
        return this.index;
    }

    public String getName() {
        return this.name;
    }

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

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

}
