提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 旁路模式类型 |
|
6 |
* @date 2023/03/15 16:33:42 |
|
7 |
*/ |
|
8 |
public enum EM_BYPASSMODE_TYPE { |
|
9 |
/** |
|
10 |
* 未知 |
|
11 |
*/ |
|
12 |
EM_BYPASSMODE_TYPE_UNKNOWN(0, "未知"), |
|
13 |
/** |
|
14 |
* 不使用 |
|
15 |
*/ |
|
16 |
EM_BYPASSMODE_TYPE_OFF(1, "不使用"), |
|
17 |
/** |
|
18 |
* 正常 |
|
19 |
*/ |
|
20 |
EM_BYPASSMODE_TYPE_ACTIVE(2, "正常"), |
|
21 |
/** |
|
22 |
* 旁路 |
|
23 |
*/ |
|
24 |
EM_BYPASSMODE_TYPE_BYPASSED(3, "旁路"), |
|
25 |
/** |
|
26 |
* 隔离 |
|
27 |
*/ |
|
28 |
EM_BYPASSMODE_TYPE_ISOLATED(4, "隔离"), |
|
29 |
/** |
|
30 |
* 测试 |
|
31 |
*/ |
|
32 |
EM_BYPASSMODE_TYPE_TEST(5, "测试"); |
|
33 |
|
|
34 |
private int value; |
|
35 |
|
|
36 |
private String note; |
|
37 |
|
|
38 |
public String getNote() { |
|
39 |
return note; |
|
40 |
} |
|
41 |
|
|
42 |
public int getValue() { |
|
43 |
return value; |
|
44 |
} |
|
45 |
|
|
46 |
EM_BYPASSMODE_TYPE(int givenValue, String note) { |
|
47 |
this.value = givenValue; |
|
48 |
this.note = note; |
|
49 |
} |
|
50 |
|
|
51 |
public static String getNoteByValue(int givenValue) { |
|
52 |
for (EM_BYPASSMODE_TYPE enumType : EM_BYPASSMODE_TYPE.values()) { |
|
53 |
if (givenValue == enumType.getValue()) { |
|
54 |
return enumType.getNote(); |
|
55 |
} |
|
56 |
} |
|
57 |
return null; |
|
58 |
} |
|
59 |
|
|
60 |
public static int getValueByNote(String givenNote) { |
|
61 |
for (EM_BYPASSMODE_TYPE enumType : EM_BYPASSMODE_TYPE.values()) { |
|
62 |
if (givenNote.equals(enumType.getNote())) { |
|
63 |
return enumType.getValue(); |
|
64 |
} |
|
65 |
} |
|
66 |
return -1; |
|
67 |
} |
|
68 |
} |