提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 离岗的触发模式 |
|
6 |
* @date 2021/03/15 |
|
7 |
*/ |
|
8 |
public enum EM_LEAVEDETECTION_TRIGGER_MODE { |
|
9 |
// 未知 |
|
10 |
EM_LEAVEDETECTION_TRIGGER_UNKNOEN(0, "未知"), |
|
11 |
// 无人 |
|
12 |
EM_LEAVEDETECTION_TRIGGER_NOPERSON(1, "无人"), |
|
13 |
// 离开 |
|
14 |
EM_LEAVEDETECTION_TRIGGER_LEAVE(2, "离开"), |
|
15 |
// 静止(睡岗) |
|
16 |
EM_LEAVEDETECTION_TRIGGER_STATIC(3, "静止(睡岗)"), |
|
17 |
// 不在允许值岗人数范围内(值岗人数异常) |
|
18 |
EM_LEAVEDETECTION_TRIGGER_OUTPERSONLIMIT(4, "不在允许值岗人数范围内(值岗人数异常)"); |
|
19 |
|
|
20 |
private int value; |
|
21 |
private String note; |
|
22 |
|
|
23 |
private EM_LEAVEDETECTION_TRIGGER_MODE(int givenValue, String note) { |
|
24 |
this.value = givenValue; |
|
25 |
this.note = note; |
|
26 |
} |
|
27 |
|
|
28 |
public String getNote() { |
|
29 |
return note; |
|
30 |
} |
|
31 |
|
|
32 |
public int getValue() { |
|
33 |
return value; |
|
34 |
} |
|
35 |
|
|
36 |
public static String getNoteByValue(int givenValue) { |
|
37 |
for (EM_LEAVEDETECTION_TRIGGER_MODE enumType : EM_LEAVEDETECTION_TRIGGER_MODE.values()) { |
|
38 |
if (givenValue == enumType.getValue()) { |
|
39 |
return enumType.getNote(); |
|
40 |
} |
|
41 |
} |
|
42 |
return null; |
|
43 |
} |
|
44 |
|
|
45 |
public static int getValueByNote(String givenNote) { |
|
46 |
for (EM_LEAVEDETECTION_TRIGGER_MODE enumType : EM_LEAVEDETECTION_TRIGGER_MODE.values()) { |
|
47 |
if (givenNote.equals(enumType.getNote())) { |
|
48 |
return enumType.getValue(); |
|
49 |
} |
|
50 |
} |
|
51 |
return -1; |
|
52 |
} |
|
53 |
|
|
54 |
} |