package org.well.well.AlarmEnumDTO;

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

    TEMP_NO_DATA("设备异常", -2),
    HUMIDITY_NO_DATA("设备异常", -1),
    TEMP_NORMAL("温度正常", 0),
    TemperatureFail("温度探头采集失败", 1),
    TemperatureError("温度探头数据异常", 2),
    HUMIDITY_NORMAL("湿度正常", 3),
    HumidityFail("湿度探头采集失败", 4),
    HumidityError("湿度探头数据异常", 5),
    TempHumiUnknown("温湿度未知异常", 6),
    Temp_OVER_THRESH("温度超限", 7),
    Humi_OVER_THRESH("湿度超限", 8),
    Temp_OVER_THRESH1("一级温度超限", 9),
    Temp_OVER_THRESH2("二级温度超限", 10),
    Temp_OVER_THRESH3("三级温度超限", 11),
    Humi_OVER_THRESH1("一级湿度超限", 12),
    Humi_OVER_THRESH2("二级湿度超限", 13),
    Humi_OVER_THRESH3("三级湿度超限", 14),
    OVER_THRESH("温湿度超限", 15);



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

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

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

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

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

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


}
