package org.well.well.AlarmEnumDTO;

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

    NO_DATA("设备异常", -1),
    NORMAL("正常", 0),
    GAS_OVER_THRESH("浓度超限", 1),
    LIQUID_OVER_THRESH("液位超限", 2),
    GasError("甲烷传感器异常", 3),
    GasCommunicationFailure("甲烷传感器通信失败", 4),
    LiquidError("浸水传感器异常", 5),
    LiquidCommunicationFailure("浸水传感器通信失败", 6),
    LGUnknown("未知异常", 7);

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

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

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

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

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

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


}
