提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* 码流类型 |
|
5 |
* |
|
6 |
* @author 47040 |
|
7 |
* @since Created at 2021/5/26 22:09 |
|
8 |
*/ |
|
9 |
public enum NET_EM_FORMAT_TYPE { |
|
10 |
|
|
11 |
EM_FORMAT_TYPE_UNKNOWN(0, "未知类型"), |
|
12 |
/*主码流*/ |
|
13 |
EM_FORMAT_MAIN_NORMAL(1, "主码流普通编码"), |
|
14 |
EM_FORMAT_MAIN_MOVEEXAMINE(2, "主码流动检编码"), |
|
15 |
EM_FORMAT_MAIN_ALARM(3, "主码流报警编码"), |
|
16 |
|
|
17 |
/*辅码流*/ |
|
18 |
EM_FORMAT_EXTRA1(4, "辅码流1"), |
|
19 |
EM_FORMAT_EXTRA2(5, "辅码流2"), |
|
20 |
EM_FORMAT_EXTRA3(6, "辅码流3"); |
|
21 |
|
|
22 |
private final int value; |
|
23 |
private final String note; |
|
24 |
|
|
25 |
NET_EM_FORMAT_TYPE(int givenValue, String note) { |
|
26 |
this.value = givenValue; |
|
27 |
this.note = note; |
|
28 |
} |
|
29 |
|
|
30 |
public String getNote() { |
|
31 |
return note; |
|
32 |
} |
|
33 |
|
|
34 |
public int getValue() { |
|
35 |
return value; |
|
36 |
} |
|
37 |
|
|
38 |
public static String getNoteByValue(int givenValue) { |
|
39 |
for (TALK_CODING_TYPE enumType : TALK_CODING_TYPE.values()) { |
|
40 |
if (givenValue == enumType.getValue()) { |
|
41 |
return enumType.getNote(); |
|
42 |
} |
|
43 |
} |
|
44 |
return null; |
|
45 |
} |
|
46 |
|
|
47 |
public static int getValueByNote(String givenNote) { |
|
48 |
for (NET_EM_FORMAT_TYPE enumType : NET_EM_FORMAT_TYPE.values()) { |
|
49 |
if (givenNote.equals(enumType.getNote())) { |
|
50 |
return enumType.getValue(); |
|
51 |
} |
|
52 |
} |
|
53 |
return -1; |
|
54 |
} |
|
55 |
|
|
56 |
public static NET_EM_FORMAT_TYPE getEnum(int value) { |
|
57 |
for (NET_EM_FORMAT_TYPE e : NET_EM_FORMAT_TYPE.values()) { |
|
58 |
if (e.getValue() == value) |
|
59 |
return e; |
|
60 |
} |
|
61 |
return NET_EM_FORMAT_TYPE.EM_FORMAT_TYPE_UNKNOWN; |
|
62 |
} |
|
63 |
} |