package org.well.well.AlarmEnumDTO;

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

    NO_DATA("设备异常", -1),
    CorrEnvTemp1Fail("1路温度采集失败", 1),
    CorrEnvTemp2Fail("2路温度采集失败", 2),
    CorrEnvTemp3Fail("3路温度采集失败", 3),
    CorrEnvTemp4Fail("4路温度采集失败", 4),
    CorrEnvTemp1Overrun("1路温度超限报警", 5),
    CorrEnvTemp2Overrun("2路温度超限报警", 6),
    CorrEnvTemp3Overrun("3路温度超限报警", 7),
    CorrEnvTemp4Overrun("4路温度超限报警", 8),
    CorrEnvPotentialOverrun("电位数据超限报警", 9),
    CorrEnvError("腐蚀环境监测仪设备异常报警", 10),
    CorrEnvADC1Fail("ADC1通信失败", 11),
    CorrEnvADC2Fail("ADC2通信失败", 12),
    TEMP_UNDER_OVER_THRESH("上保温层内外温差过高",13),
    TEMP_OUTTER_OVER_THRESH("下保温层内外温差过高",14);

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

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

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

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

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

    public static CorrosionEnvironmentAlarmEnum getByName(String name) {
        try {
            for (CorrosionEnvironmentAlarmEnum temp : values()) {
                if (temp.name.equals(name)) {
                    return temp;
                }
            }
        } catch (Exception e) {
        }
        return null;
    }

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


}
