houzhongjian
2024-10-30 a28ca3f36d0ace05966a8c0fac1e4b5fe921f882
提交 | 用户 | 时间
ce910c 1 package com.netsdk.lib.enumeration;
H 2
3
4 /**
5  * @author : 291189
6  * @since : Created in 2021/6/30 10:22
7  * 安全门人员报警级别
8  */
9 public enum  EM_SECURITYGATE_ALARM_LEVEL {
10     EM_SECURITYGATE_ALARM_LEVEL_UNKNOWN(0,"未知"),                // 未知
11     EM_SECURITYGATE_ALARM_LEVEL_NON(1,"无报警"),                    // 无报警
12     EM_SECURITYGATE_ALARM_LEVEL_LOW(2,"低危报警级别"),                    // 低危报警级别
13     EM_SECURITYGATE_ALARM_LEVEL_MIDDLE(3,"中危报警级别"),                    // 中危报警级别
14     EM_SECURITYGATE_ALARM_LEVEL_HIGH(4,"高危报警级别");                    // 高危报警级别
15
16     private final int value;
17     private final String note;
18
19     EM_SECURITYGATE_ALARM_LEVEL(int givenValue, String note) {
20         this.value = givenValue;
21         this.note = note;
22     }
23
24     public String getNote() {
25         return note;
26     }
27
28     public int getValue() {
29         return value;
30     }
31
32     public static String getNoteByValue(int givenValue) {
33         for (EM_SECURITYGATE_ALARM_LEVEL enumType : EM_SECURITYGATE_ALARM_LEVEL.values()) {
34             if (givenValue == enumType.getValue()) {
35                 return enumType.getNote();
36             }
37         }
38         return null;
39     }
40
41     public static int getValueByNote(String givenNote) {
42         for (EM_SECURITYGATE_ALARM_LEVEL enumType : EM_SECURITYGATE_ALARM_LEVEL.values()) {
43             if (givenNote.equals(enumType.getNote())) {
44                 return enumType.getValue();
45             }
46         }
47         return -1;
48     }
49
50     public static EM_SECURITYGATE_ALARM_LEVEL getEnum(int value) {
51         for (EM_SECURITYGATE_ALARM_LEVEL e : EM_SECURITYGATE_ALARM_LEVEL.values()) {
52             if (e.getValue() == value)
53                 return e;
54         }
55         return EM_SECURITYGATE_ALARM_LEVEL.EM_SECURITYGATE_ALARM_LEVEL_UNKNOWN;
56     }
57 }