提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 倒计时方式 |
|
6 |
* @date 2021/08/24 |
|
7 |
*/ |
|
8 |
public enum EM_COUNTDOWN_TYPE { |
|
9 |
// 未知 |
|
10 |
EM_COUNTDOWN_TYPE_UNKNOWN(0, "未知"), |
|
11 |
// 学习式 |
|
12 |
EM_COUNTDOWN_TYPE_LEARNING(1, "学习式"), |
|
13 |
// 脉冲式 |
|
14 |
EM_COUNTDOWN_TYPE_PLUSE(2, "脉冲式"), |
|
15 |
// 全程485式 |
|
16 |
EM_COUNTDOWN_TYPE_FULL485(3, "全程485式"), |
|
17 |
// 半程485式 |
|
18 |
EM_COUNTDOWN_TYPE_HALFWAY485(4, "半程485式"); |
|
19 |
|
|
20 |
private int value; |
|
21 |
private String note; |
|
22 |
|
|
23 |
private EM_COUNTDOWN_TYPE(int givenValue, String note) { |
|
24 |
this.value = givenValue; |
|
25 |
this.note = note; |
|
26 |
} |
|
27 |
|
|
28 |
public String getNote() { |
|
29 |
return note; |
|
30 |
} |
|
31 |
|
|
32 |
public int getValue() { |
|
33 |
return value; |
|
34 |
} |
|
35 |
|
|
36 |
public static String getNoteByValue(int givenValue) { |
|
37 |
for (EM_COUNTDOWN_TYPE enumType : EM_COUNTDOWN_TYPE.values()) { |
|
38 |
if (givenValue == enumType.getValue()) { |
|
39 |
return enumType.getNote(); |
|
40 |
} |
|
41 |
} |
|
42 |
return null; |
|
43 |
} |
|
44 |
|
|
45 |
public static int getValueByNote(String givenNote) { |
|
46 |
for (EM_COUNTDOWN_TYPE enumType : EM_COUNTDOWN_TYPE.values()) { |
|
47 |
if (givenNote.equals(enumType.getNote())) { |
|
48 |
return enumType.getValue(); |
|
49 |
} |
|
50 |
} |
|
51 |
return -1; |
|
52 |
} |
|
53 |
} |