package org.well.well.AlarmEnumDTO;

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

    NO_DATA("设备异常", -1),
    NORMAL("正常", 0),
    NoiseDigFail("开挖探头采集失败", 1),
    NoiseDigError("开挖探头数据异常", 2),
    NoiseDigUnknown("开挖未知异常", 3),
    OVER_THRESH("疑似开挖", 4),
    OVER_THRESH1("一级疑似开挖", 5),
    OVER_THRESH2("二级疑似开挖", 6),
    OVER_THRESH3("三级疑似开挖", 7);


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

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

    public String getName() {
        return name;
    }

    public int getIndex() {
        return index;
    }

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

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