提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 260611 |
|
6 |
* @description 目标类型 |
|
7 |
* @date 2022/11/21 17:53:12 |
|
8 |
*/ |
|
9 |
public enum EM_DETECT_OBJECT_TYPE { |
|
10 |
/** |
|
11 |
* 未知 |
|
12 |
*/ |
|
13 |
EM_DETECT_OBJECT_TYPE_UNKNOWN(0, "未知"), |
|
14 |
/** |
|
15 |
* 人脸 |
|
16 |
*/ |
|
17 |
EM_DETECT_OBJECT_TYPE_FACE(1, "人脸"), |
|
18 |
/** |
|
19 |
* 车辆 |
|
20 |
*/ |
|
21 |
EM_DETECT_OBJECT_TYPE_VEHICLE(2, "车辆"), |
|
22 |
/** |
|
23 |
* 结构化 |
|
24 |
*/ |
|
25 |
EM_DETECT_OBJECT_TYPE_STRUCTLIZE(3, "结构化"); |
|
26 |
|
|
27 |
private int value; |
|
28 |
|
|
29 |
private String note; |
|
30 |
|
|
31 |
public String getNote() { |
|
32 |
return note; |
|
33 |
} |
|
34 |
|
|
35 |
public int getValue() { |
|
36 |
return value; |
|
37 |
} |
|
38 |
|
|
39 |
EM_DETECT_OBJECT_TYPE(int givenValue, String note) { |
|
40 |
this.value = givenValue; |
|
41 |
this.note = note; |
|
42 |
} |
|
43 |
|
|
44 |
public static String getNoteByValue(int givenValue) { |
|
45 |
for (EM_DETECT_OBJECT_TYPE enumType : EM_DETECT_OBJECT_TYPE.values()) { |
|
46 |
if (givenValue == enumType.getValue()) { |
|
47 |
return enumType.getNote(); |
|
48 |
} |
|
49 |
} |
|
50 |
return null; |
|
51 |
} |
|
52 |
|
|
53 |
public static int getValueByNote(String givenNote) { |
|
54 |
for (EM_DETECT_OBJECT_TYPE enumType : EM_DETECT_OBJECT_TYPE.values()) { |
|
55 |
if (givenNote.equals(enumType.getNote())) { |
|
56 |
return enumType.getValue(); |
|
57 |
} |
|
58 |
} |
|
59 |
return -1; |
|
60 |
} |
|
61 |
|
|
62 |
public static EM_DETECT_OBJECT_TYPE getEnum(int value) { |
|
63 |
for (EM_DETECT_OBJECT_TYPE e : EM_DETECT_OBJECT_TYPE.values()) { |
|
64 |
if (e.getValue() == value) |
|
65 |
return e; |
|
66 |
} |
|
67 |
return EM_DETECT_OBJECT_TYPE.EM_DETECT_OBJECT_TYPE_UNKNOWN; |
|
68 |
} |
|
69 |
|
|
70 |
} |