package org.well.well.AlarmEnumDTO;

/**
 * Created by admin on 2017/4/6.
 */
public enum LiquidAlarmEnum {
    NO_DATA("设备异常", -1),
    LiquidUltrasonicFail("液位超声波探头采集失败", 1),
    LiquidUltrasonicError("液位超声波探头数据异常", 2),
    LiquidPressureFail("液位静压探头采集失败", 3),
    LiquidPressureError("液位静压探头数据异常", 4),
    LiquidUnknown("液位未知异常", 5),
    OVER_THRESH("液位超限", 6),
    OVER_THRESH1("一级液位超限", 7),
    OVER_THRESH2("二级液位超限", 8),
    OVER_THRESH3("三级液位超限", 9);

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

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

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

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

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

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


}
