package org.well.well.AlarmEnumDTO;

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

    NO_DATA("设备异常", -1),
    NORMAL("正常", 0),
    OVER_THRESH("浓度超限", 1),
    TubeCommunicationFailure("传感器通信失败", 2),
    TubeError("管盯传感器异常", 3),
    TubeUnknown("管盯未知异常", 4),
    OVER_THRESH1("一级浓度超限", 5),
    OVER_THRESH2("二级浓度超限", 6);

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

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

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

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

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

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


}
