提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 421657 |
|
6 |
* @description 报警使能控制方式枚举类型 |
|
7 |
* @origin autoTool |
|
8 |
* @date 2023/11/01 20:42:35 |
|
9 |
*/ |
|
10 |
public enum EM_CTRL_ENABLE { |
|
11 |
/** |
|
12 |
* 不控制使能 |
|
13 |
*/ |
|
14 |
EM_CTRL_NORMAL(0, "不控制使能"), |
|
15 |
/** |
|
16 |
* 总是使能 |
|
17 |
*/ |
|
18 |
EM_CTRL_ALWAYS_EN(1, "总是使能"), |
|
19 |
/** |
|
20 |
* 旁路 |
|
21 |
*/ |
|
22 |
EM_CTRL_ONCE_DIS(2, "旁路"), |
|
23 |
/** |
|
24 |
* 移除 |
|
25 |
*/ |
|
26 |
EM_CTRL_ALWAYS_DIS(3, "移除"), |
|
27 |
/** |
|
28 |
* 枚举类型总数 |
|
29 |
*/ |
|
30 |
EM_CTRL_NU(4, "枚举类型总数"); |
|
31 |
|
|
32 |
private int value; |
|
33 |
|
|
34 |
private String note; |
|
35 |
|
|
36 |
public String getNote() { |
|
37 |
return note; |
|
38 |
} |
|
39 |
|
|
40 |
public int getValue() { |
|
41 |
return value; |
|
42 |
} |
|
43 |
|
|
44 |
EM_CTRL_ENABLE(int givenValue, String note) { |
|
45 |
this.value = givenValue; |
|
46 |
this.note = note; |
|
47 |
} |
|
48 |
|
|
49 |
public static String getNoteByValue(int givenValue) { |
|
50 |
for (EM_CTRL_ENABLE enumType : EM_CTRL_ENABLE.values()) { |
|
51 |
if (givenValue == enumType.getValue()) { |
|
52 |
return enumType.getNote(); |
|
53 |
} |
|
54 |
} |
|
55 |
return null; |
|
56 |
} |
|
57 |
|
|
58 |
public static int getValueByNote(String givenNote) { |
|
59 |
for (EM_CTRL_ENABLE enumType : EM_CTRL_ENABLE.values()) { |
|
60 |
if (givenNote.equals(enumType.getNote())) { |
|
61 |
return enumType.getValue(); |
|
62 |
} |
|
63 |
} |
|
64 |
return -1; |
|
65 |
} |
|
66 |
|
|
67 |
public static EM_CTRL_ENABLE getEnum(int value) { |
|
68 |
for (EM_CTRL_ENABLE e : EM_CTRL_ENABLE.values()) { |
|
69 |
if (e.getValue() == value) { |
|
70 |
return e; |
|
71 |
} |
|
72 |
} |
|
73 |
return EM_CTRL_ENABLE.EM_CTRL_NORMAL; |
|
74 |
} |
|
75 |
|
|
76 |
} |