package org.well.well.AlarmEnumDTO;

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

    NOISE_NO_DATA("噪声探头异常",-3),
    PRESS_NO_DATA("压力探头异常",-2),
    FLOW_NO_DATA("流量探头异常",-1),
    FLOW_NORMAL("流量正常",0),
    PRESS_NORMAL("压力正常",1),
    NOISE_NORMAL("噪声正常",2),
    PRESS_OVER_THRESH("压力监测值超上限",3),
    PRESS_LOW_THRESH("压力监测值低于下限",4),
    NOISE_OVER_THRESH("噪声监测值超限",5),
    MultiLeakFlowFail("流量探头采集失败",6),
    MultiLeakFlowError("流量探头数据异常",7),
    MultiLeakPressureFail("压力探头采集失败",8),
    MultiLeakPressureError("压力探头数据异常",9),
    MultiLeakNoiseFail("噪声探头采集失败",10),
    MultiLeakNoiseError("噪声探头数据异常",11),
    MultiLeakUnknown("未知异常",12);
    // 成员变量
    private String name;
    private int index;
    // 构造方法
    private MultiLeakAlarmEnum(String name, int index){
        this.name=name;
        this.index=index;
    }

    public int getIndex() {
        return index;
    }

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

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

    public String getName() {
        return name;
    }
}
