package org.well.well.AlarmEnumDTO;

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

    NO_DATA("设备异常", -1),
    NORMAL("正常", 0),
    OVER_THRESH("浓度超限", 1),
    MethaneFail("燃气探头采集失败", 2),
    MethaneError("燃气探头数据异常", 3),
    MethaneUnknown("燃气未知异常", 4),
    OVER_THRESH1("一级浓度超限", 5),
    OVER_THRESH2("二级浓度超限", 6);

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

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

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

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

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

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


}
