提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 自定义抓图类型 |
|
7 |
* @date 2022/03/31 14:04:19 |
|
8 |
*/ |
|
9 |
public enum EM_CUSTOM_SNAP_TYPE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_CUSTOM_SNAP_UNKNOWN(0,"未知"), |
|
14 |
/** |
|
15 |
猪体温检测, 对应结构体 NET_PIG_TEMPERATURE_INFO |
|
16 |
*/ |
|
17 |
EM_CUSTOM_SNAP_PIG_TEMPERATURE(1,"猪体温检测, 对应结构体 NET_PIG_TEMPERATURE_INFO"); |
|
18 |
|
|
19 |
private int value; |
|
20 |
|
|
21 |
private String note; |
|
22 |
|
|
23 |
public String getNote() { |
|
24 |
return note; |
|
25 |
} |
|
26 |
|
|
27 |
public int getValue() { |
|
28 |
return value; |
|
29 |
} |
|
30 |
|
|
31 |
EM_CUSTOM_SNAP_TYPE(int givenValue, String note) { |
|
32 |
this.value = givenValue; |
|
33 |
this.note = note; |
|
34 |
} |
|
35 |
|
|
36 |
public static String getNoteByValue(int givenValue) { |
|
37 |
for (EM_CUSTOM_SNAP_TYPE enumType : EM_CUSTOM_SNAP_TYPE.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_CUSTOM_SNAP_TYPE enumType : EM_CUSTOM_SNAP_TYPE.values()) { |
|
47 |
if (givenNote.equals(enumType.getNote())) { |
|
48 |
return enumType.getValue(); |
|
49 |
} |
|
50 |
} |
|
51 |
return -1; |
|
52 |
} |
|
53 |
|
|
54 |
public static EM_CUSTOM_SNAP_TYPE getEnum(int value) { |
|
55 |
for (EM_CUSTOM_SNAP_TYPE e : EM_CUSTOM_SNAP_TYPE.values()) { |
|
56 |
if (e.getValue() == value) |
|
57 |
return e; |
|
58 |
} |
|
59 |
return EM_CUSTOM_SNAP_TYPE.EM_CUSTOM_SNAP_UNKNOWN; |
|
60 |
} |
|
61 |
|
|
62 |
} |