提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 表盘状态 |
|
7 |
* @date 2022/06/28 19:44:55 |
|
8 |
*/ |
|
9 |
public enum EM_DIAL_STATE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_DIAL_STATE_UNKNOWN(0,"未知"), |
|
14 |
/** |
|
15 |
正常 |
|
16 |
*/ |
|
17 |
EM_DIAL_STATE_NORMAL(1,"正常"), |
|
18 |
/** |
|
19 |
模糊 |
|
20 |
*/ |
|
21 |
EM_DIAL_STATE_DIM(2,"模糊"), |
|
22 |
/** |
|
23 |
表盘破损 |
|
24 |
*/ |
|
25 |
EM_DIAL_STATE_DIAL_BROKEN(3,"表盘破损"), |
|
26 |
/** |
|
27 |
外壳破裂 |
|
28 |
*/ |
|
29 |
EM_DIAL_STATE_SHELL_BROKEN(4,"外壳破裂"), |
|
30 |
/** |
|
31 |
读数异常 |
|
32 |
*/ |
|
33 |
EM_DIAL_STATE_ABNORMAL_READING(5,"读数异常"); |
|
34 |
|
|
35 |
private int value; |
|
36 |
|
|
37 |
private String note; |
|
38 |
|
|
39 |
public String getNote() { |
|
40 |
return note; |
|
41 |
} |
|
42 |
|
|
43 |
public int getValue() { |
|
44 |
return value; |
|
45 |
} |
|
46 |
|
|
47 |
EM_DIAL_STATE(int givenValue, String note) { |
|
48 |
this.value = givenValue; |
|
49 |
this.note = note; |
|
50 |
} |
|
51 |
|
|
52 |
public static String getNoteByValue(int givenValue) { |
|
53 |
for (EM_DIAL_STATE enumType : EM_DIAL_STATE.values()) { |
|
54 |
if (givenValue == enumType.getValue()) { |
|
55 |
return enumType.getNote(); |
|
56 |
} |
|
57 |
} |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 |
public static int getValueByNote(String givenNote) { |
|
62 |
for (EM_DIAL_STATE enumType : EM_DIAL_STATE.values()) { |
|
63 |
if (givenNote.equals(enumType.getNote())) { |
|
64 |
return enumType.getValue(); |
|
65 |
} |
|
66 |
} |
|
67 |
return -1; |
|
68 |
} |
|
69 |
|
|
70 |
public static EM_DIAL_STATE getEnum(int value) { |
|
71 |
for (EM_DIAL_STATE e : EM_DIAL_STATE.values()) { |
|
72 |
if (e.getValue() == value) |
|
73 |
return e; |
|
74 |
} |
|
75 |
return EM_DIAL_STATE.EM_DIAL_STATE_UNKNOWN; |
|
76 |
} |
|
77 |
|
|
78 |
} |