提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 通道类型 |
|
7 |
* @date 2022/10/09 11:22:21 |
|
8 |
*/ |
|
9 |
public enum EM_CHANNELS_STATE_TYPE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_CHANNELS_STATE_TYPE_UNKNOWN(0,"未知"), |
|
14 |
/** |
|
15 |
所有通道 |
|
16 |
*/ |
|
17 |
EM_CHANNELS_STATE_TYPE_ALL(1,"所有通道"), |
|
18 |
/** |
|
19 |
报警输入通道 |
|
20 |
*/ |
|
21 |
EM_CHANNELS_STATE_TYPE_ALARMIN(2,"报警输入通道"), |
|
22 |
/** |
|
23 |
报警输出通道 |
|
24 |
*/ |
|
25 |
EM_CHANNELS_STATE_TYPE_ALARMOUT(3,"报警输出通道"), |
|
26 |
/** |
|
27 |
警号通道 |
|
28 |
*/ |
|
29 |
EM_CHANNELS_STATE_TYPE_SIREN(4,"警号通道"); |
|
30 |
|
|
31 |
private int value; |
|
32 |
|
|
33 |
private String note; |
|
34 |
|
|
35 |
public String getNote() { |
|
36 |
return note; |
|
37 |
} |
|
38 |
|
|
39 |
public int getValue() { |
|
40 |
return value; |
|
41 |
} |
|
42 |
|
|
43 |
EM_CHANNELS_STATE_TYPE(int givenValue, String note) { |
|
44 |
this.value = givenValue; |
|
45 |
this.note = note; |
|
46 |
} |
|
47 |
|
|
48 |
public static String getNoteByValue(int givenValue) { |
|
49 |
for (EM_CHANNELS_STATE_TYPE enumType : EM_CHANNELS_STATE_TYPE.values()) { |
|
50 |
if (givenValue == enumType.getValue()) { |
|
51 |
return enumType.getNote(); |
|
52 |
} |
|
53 |
} |
|
54 |
return null; |
|
55 |
} |
|
56 |
|
|
57 |
public static int getValueByNote(String givenNote) { |
|
58 |
for (EM_CHANNELS_STATE_TYPE enumType : EM_CHANNELS_STATE_TYPE.values()) { |
|
59 |
if (givenNote.equals(enumType.getNote())) { |
|
60 |
return enumType.getValue(); |
|
61 |
} |
|
62 |
} |
|
63 |
return -1; |
|
64 |
} |
|
65 |
|
|
66 |
public static EM_CHANNELS_STATE_TYPE getEnum(int value) { |
|
67 |
for (EM_CHANNELS_STATE_TYPE e : EM_CHANNELS_STATE_TYPE.values()) { |
|
68 |
if (e.getValue() == value) |
|
69 |
return e; |
|
70 |
} |
|
71 |
return EM_CHANNELS_STATE_TYPE.EM_CHANNELS_STATE_TYPE_UNKNOWN; |
|
72 |
} |
|
73 |
|
|
74 |
} |