package org.well.well.AlarmEnumDTO;

/**
 * Created by admin on 2017/4/6.
 */
public enum CorrosionRateAlarmEnum {
    NO_DATA("设备异常", -1),
    NORMAL("正常", 0),
    CorrRateFail("腐蚀速率采集失败", 1),
    CorrRateError("腐蚀速率数据异常", 2),
    OVER_THRESH("腐蚀量超限", 3),
    CorrRateUnknown("腐蚀速率未知异常", 4);

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

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

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

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

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

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


}
