提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* 抓拍策略取值 |
|
5 |
* |
|
6 |
* @author 47040 |
|
7 |
* @since Created in 2021/4/25 19:52 |
|
8 |
*/ |
|
9 |
public enum EM_SNAP_POLICY_TYPE { |
|
10 |
|
|
11 |
EM_SNAP_POLICY_TYPE_UNKNOWN(0, "未知"), |
|
12 |
EM_SNAP_POLICY_TYPE_REALTIME(1, "实时"), |
|
13 |
EM_SNAP_POLICY_TYPE_OPTIMAL(2, "优选"), |
|
14 |
EM_SNAP_POLICY_TYPE_QUALITY(3, "质量"), |
|
15 |
EM_SNAP_POLICY_TYPE_TRIPLINE(4, "拌线"); |
|
16 |
|
|
17 |
private final int value; |
|
18 |
private final String note; |
|
19 |
|
|
20 |
EM_SNAP_POLICY_TYPE(int givenValue, String note) { |
|
21 |
this.value = givenValue; |
|
22 |
this.note = note; |
|
23 |
} |
|
24 |
|
|
25 |
public String getNote() { |
|
26 |
return note; |
|
27 |
} |
|
28 |
|
|
29 |
public int getValue() { |
|
30 |
return value; |
|
31 |
} |
|
32 |
|
|
33 |
public static String getNoteByValue(int givenValue) { |
|
34 |
for (EM_SNAP_POLICY_TYPE enumType : EM_SNAP_POLICY_TYPE.values()) { |
|
35 |
if (givenValue == enumType.getValue()) { |
|
36 |
return enumType.getNote(); |
|
37 |
} |
|
38 |
} |
|
39 |
return null; |
|
40 |
} |
|
41 |
|
|
42 |
public static int getValueByNote(String givenNote) { |
|
43 |
for (EM_SNAP_POLICY_TYPE enumType : EM_SNAP_POLICY_TYPE.values()) { |
|
44 |
if (givenNote.equals(enumType.getNote())) { |
|
45 |
return enumType.getValue(); |
|
46 |
} |
|
47 |
} |
|
48 |
return -1; |
|
49 |
} |
|
50 |
|
|
51 |
public static EM_SNAP_POLICY_TYPE getEnum(int value) { |
|
52 |
for (EM_SNAP_POLICY_TYPE e : EM_SNAP_POLICY_TYPE.values()) { |
|
53 |
if (e.getValue() == value) |
|
54 |
return e; |
|
55 |
} |
|
56 |
return EM_SNAP_POLICY_TYPE.EM_SNAP_POLICY_TYPE_UNKNOWN; |
|
57 |
} |
|
58 |
} |