提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 仪表类型 |
|
7 |
* @date 2022/06/28 19:24:08 |
|
8 |
*/ |
|
9 |
public enum EM_INSTRUMENT_TYPE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_INSTRUMENT_TYPE_UNKNOWN(0,"未知"), |
|
14 |
/** |
|
15 |
状态识别类型 |
|
16 |
*/ |
|
17 |
EM_INSTRUMENT_TYPE_STATE(1,"状态识别类型"), |
|
18 |
/** |
|
19 |
状态匹配类型 |
|
20 |
*/ |
|
21 |
EM_INSTRUMENT_TYPE_STATEMATCH(2,"状态匹配类型"), |
|
22 |
/** |
|
23 |
指针式表计类型 |
|
24 |
*/ |
|
25 |
EM_INSTRUMENT_TYPE_METER(3,"指针式表计类型"), |
|
26 |
/** |
|
27 |
数字识别类型 |
|
28 |
*/ |
|
29 |
EM_INSTRUMENT_TYPE_CHAR(4,"数字识别类型"), |
|
30 |
/** |
|
31 |
油表类型 |
|
32 |
*/ |
|
33 |
EM_INSTRUMENT_TYPE_OIL(5,"油表类型"), |
|
34 |
/** |
|
35 |
开关标识 |
|
36 |
*/ |
|
37 |
EM_INSTRUMENT_TYPE_SWIIDEN(6,"开关标识"), |
|
38 |
/** |
|
39 |
指示灯类型 |
|
40 |
*/ |
|
41 |
EM_INSTRUMENT_TYPE_LIGHT(7,"指示灯类型"), |
|
42 |
/** |
|
43 |
室内开关类型 |
|
44 |
*/ |
|
45 |
EM_INSTRUMENT_TYPE_SWITCH(8,"室内开关类型"), |
|
46 |
/** |
|
47 |
外观检测类型 |
|
48 |
*/ |
|
49 |
EM_INSTRUMENT_TYPE_APPEARANCE(9,"外观检测类型"), |
|
50 |
/** |
|
51 |
液位计 |
|
52 |
*/ |
|
53 |
EM_INSTRUMENT_TYPE_LEVELGAUGE(10,"液位计"); |
|
54 |
|
|
55 |
private int value; |
|
56 |
|
|
57 |
private String note; |
|
58 |
|
|
59 |
public String getNote() { |
|
60 |
return note; |
|
61 |
} |
|
62 |
|
|
63 |
public int getValue() { |
|
64 |
return value; |
|
65 |
} |
|
66 |
|
|
67 |
EM_INSTRUMENT_TYPE(int givenValue, String note) { |
|
68 |
this.value = givenValue; |
|
69 |
this.note = note; |
|
70 |
} |
|
71 |
|
|
72 |
public static String getNoteByValue(int givenValue) { |
|
73 |
for (EM_INSTRUMENT_TYPE enumType : EM_INSTRUMENT_TYPE.values()) { |
|
74 |
if (givenValue == enumType.getValue()) { |
|
75 |
return enumType.getNote(); |
|
76 |
} |
|
77 |
} |
|
78 |
return null; |
|
79 |
} |
|
80 |
|
|
81 |
public static int getValueByNote(String givenNote) { |
|
82 |
for (EM_INSTRUMENT_TYPE enumType : EM_INSTRUMENT_TYPE.values()) { |
|
83 |
if (givenNote.equals(enumType.getNote())) { |
|
84 |
return enumType.getValue(); |
|
85 |
} |
|
86 |
} |
|
87 |
return -1; |
|
88 |
} |
|
89 |
|
|
90 |
public static EM_INSTRUMENT_TYPE getEnum(int value) { |
|
91 |
for (EM_INSTRUMENT_TYPE e : EM_INSTRUMENT_TYPE.values()) { |
|
92 |
if (e.getValue() == value) |
|
93 |
return e; |
|
94 |
} |
|
95 |
return EM_INSTRUMENT_TYPE.EM_INSTRUMENT_TYPE_UNKNOWN; |
|
96 |
} |
|
97 |
|
|
98 |
} |