提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 灯组灯色 |
|
6 |
* @date 2021/09/01 |
|
7 |
*/ |
|
8 |
public enum EM_LAMP_COLOR { |
|
9 |
// 未知 |
|
10 |
EM_LAMP_COLOR_UNKOWN(-1, "未知"), |
|
11 |
// 无灯 |
|
12 |
EM_LAMP_COLOR_NO(0, "无灯"), |
|
13 |
// 灭灯 |
|
14 |
EM_LAMP_COLOR_LIGHT_OFF(1, "灭灯"), |
|
15 |
// 亮灯 |
|
16 |
EM_LAMP_COLOR_LIGHT_ON(2, "亮灯"), |
|
17 |
// 闪烁 |
|
18 |
EM_LAMP_COLOR_LIGHT_FLASH(3, "闪烁"); |
|
19 |
|
|
20 |
private int value; |
|
21 |
private String note; |
|
22 |
|
|
23 |
private EM_LAMP_COLOR(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_LAMP_COLOR enumType : EM_LAMP_COLOR.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_LAMP_COLOR enumType : EM_LAMP_COLOR.values()) { |
|
47 |
if (givenNote.equals(enumType.getNote())) { |
|
48 |
return enumType.getValue(); |
|
49 |
} |
|
50 |
} |
|
51 |
return -2; |
|
52 |
} |
|
53 |
} |