提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 播报文本类型 |
|
6 |
* @date 2022/11/28 16:20:42 |
|
7 |
*/ |
|
8 |
public enum EM_BROADCAST_TEXT_TYPE { |
|
9 |
/** |
|
10 |
* 未知 |
|
11 |
*/ |
|
12 |
EM_BROADCAST_TEXT_TYPE_UNKNOWN(-1, "未知"), |
|
13 |
/** |
|
14 |
* 普通 |
|
15 |
*/ |
|
16 |
EM_BROADCAST_TEXT_TYPE_ORDINARY(0, "普通"), |
|
17 |
/** |
|
18 |
* 车牌号 |
|
19 |
*/ |
|
20 |
EM_BROADCAST_TEXT_TYPE_PLATE_NUMBER(1, "车牌号"), |
|
21 |
/** |
|
22 |
* 时间 |
|
23 |
*/ |
|
24 |
EM_BROADCAST_TEXT_TYPE_TIME(2, "时间"), |
|
25 |
/** |
|
26 |
* 数字字符串 |
|
27 |
*/ |
|
28 |
EM_BROADCAST_TEXT_TYPE_NUMBER_STRING(3, "数字字符串"); |
|
29 |
|
|
30 |
private int value; |
|
31 |
|
|
32 |
private String note; |
|
33 |
|
|
34 |
public String getNote() { |
|
35 |
return note; |
|
36 |
} |
|
37 |
|
|
38 |
public int getValue() { |
|
39 |
return value; |
|
40 |
} |
|
41 |
|
|
42 |
EM_BROADCAST_TEXT_TYPE(int givenValue, String note) { |
|
43 |
this.value = givenValue; |
|
44 |
this.note = note; |
|
45 |
} |
|
46 |
|
|
47 |
public static String getNoteByValue(int givenValue) { |
|
48 |
for (EM_BROADCAST_TEXT_TYPE enumType : EM_BROADCAST_TEXT_TYPE.values()) { |
|
49 |
if (givenValue == enumType.getValue()) { |
|
50 |
return enumType.getNote(); |
|
51 |
} |
|
52 |
} |
|
53 |
return null; |
|
54 |
} |
|
55 |
|
|
56 |
public static int getValueByNote(String givenNote) { |
|
57 |
for (EM_BROADCAST_TEXT_TYPE enumType : EM_BROADCAST_TEXT_TYPE.values()) { |
|
58 |
if (givenNote.equals(enumType.getNote())) { |
|
59 |
return enumType.getValue(); |
|
60 |
} |
|
61 |
} |
|
62 |
return -2; |
|
63 |
} |
|
64 |
} |