package org.well.well.AlarmEnumDTO;

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

    TEMP_NO_DATA("设备异常", -2),
    PRESS_NO_DATA("设备异常", -1),
    TEMP_NORMAL("温度正常", 0),
    TemperatureFail("温度探头采集失败", 1),
    TemperatureError("温度探头数据异常", 2),
    PRESS_NORMAL("压力正常", 3),
    PressureFail("压力探头采集失败", 4),
    PressureError("压力探头数据异常", 5),
    TempPressureUnknown("温度压力未知异常", 6);

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

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

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

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

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

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


}
