提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 温度类型 |
|
6 |
* @date 2022/05/12 16:32:08 |
|
7 |
*/ |
|
8 |
public enum EM_TEMPERATUREEX_TYPE { |
|
9 |
/** |
|
10 |
* 未知 |
|
11 |
*/ |
|
12 |
EM_TEMPERATUREEX_TYPE_UNKNOWN(0, "未知"), |
|
13 |
/** |
|
14 |
* 全部 |
|
15 |
*/ |
|
16 |
EM_TEMPERATUREEX_TYPE_ALL(1, "全部"), |
|
17 |
/** |
|
18 |
* 电源 |
|
19 |
*/ |
|
20 |
EM_TEMPERATUREEX_TYPE_POWER(2, "电源"), |
|
21 |
/** |
|
22 |
* 机柜 |
|
23 |
*/ |
|
24 |
EM_TEMPERATUREEX_TYPE_CABINET(3, "机柜"), |
|
25 |
/** |
|
26 |
* 环境 |
|
27 |
*/ |
|
28 |
EM_TEMPERATUREEX_TYPE_GLOBAL(4, "环境"), |
|
29 |
/** |
|
30 |
* 主板 |
|
31 |
*/ |
|
32 |
EM_TEMPERATUREEX_TYPE_MAINBOARD(5, "主板"), |
|
33 |
/** |
|
34 |
* 子卡 |
|
35 |
*/ |
|
36 |
EM_TEMPERATUREEX_TYPE_CARD(6, "子卡"), |
|
37 |
/** |
|
38 |
* 背板 |
|
39 |
*/ |
|
40 |
EM_TEMPERATUREEX_TYPE_BACKBOARD(7, "背板"), |
|
41 |
/** |
|
42 |
* 处理器 |
|
43 |
*/ |
|
44 |
EM_TEMPERATUREEX_TYPE_CPU(8, "处理器"); |
|
45 |
|
|
46 |
private int value; |
|
47 |
|
|
48 |
private String note; |
|
49 |
|
|
50 |
public String getNote() { |
|
51 |
return note; |
|
52 |
} |
|
53 |
|
|
54 |
public int getValue() { |
|
55 |
return value; |
|
56 |
} |
|
57 |
|
|
58 |
EM_TEMPERATUREEX_TYPE(int givenValue, String note) { |
|
59 |
this.value = givenValue; |
|
60 |
this.note = note; |
|
61 |
} |
|
62 |
|
|
63 |
public static String getNoteByValue(int givenValue) { |
|
64 |
for (EM_TEMPERATUREEX_TYPE enumType : EM_TEMPERATUREEX_TYPE.values()) { |
|
65 |
if (givenValue == enumType.getValue()) { |
|
66 |
return enumType.getNote(); |
|
67 |
} |
|
68 |
} |
|
69 |
return null; |
|
70 |
} |
|
71 |
|
|
72 |
public static int getValueByNote(String givenNote) { |
|
73 |
for (EM_TEMPERATUREEX_TYPE enumType : EM_TEMPERATUREEX_TYPE.values()) { |
|
74 |
if (givenNote.equals(enumType.getNote())) { |
|
75 |
return enumType.getValue(); |
|
76 |
} |
|
77 |
} |
|
78 |
return -1; |
|
79 |
} |
|
80 |
} |