提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 260611 |
|
6 |
* @description 场景触发过滤条件类型 |
|
7 |
* @date 2022/04/20 11:28:14 |
|
8 |
*/ |
|
9 |
public enum EM_THINGS_CONDITION_TYPE { |
|
10 |
/** |
|
11 |
* 未知 |
|
12 |
*/ |
|
13 |
EM_THINGS_CONDITION_TYPE_UNKNOWN(0, "未知"), |
|
14 |
/** |
|
15 |
* condition/timeRange 比较当前时间是否在一个区间内,对应结构体 |
|
16 |
*/ |
|
17 |
EM_THINGS_CONDITION_TYPE_TIMERANGE(1, " condition/timeRange 比较当前时间是否在一个区间内,对应结构体"), |
|
18 |
/** |
|
19 |
* condition/device/property 设备属性过滤,对应结构体 |
|
20 |
*/ |
|
21 |
EM_THINGS_CONDITION_TYPE_PROPERTY(2, " condition/device/property 设备属性过滤,对应结构体"); |
|
22 |
|
|
23 |
private int value; |
|
24 |
|
|
25 |
private String note; |
|
26 |
|
|
27 |
public String getNote() { |
|
28 |
return note; |
|
29 |
} |
|
30 |
|
|
31 |
public int getValue() { |
|
32 |
return value; |
|
33 |
} |
|
34 |
|
|
35 |
EM_THINGS_CONDITION_TYPE(int givenValue, String note) { |
|
36 |
this.value = givenValue; |
|
37 |
this.note = note; |
|
38 |
} |
|
39 |
|
|
40 |
public static String getNoteByValue(int givenValue) { |
|
41 |
for (EM_THINGS_CONDITION_TYPE enumType : EM_THINGS_CONDITION_TYPE.values()) { |
|
42 |
if (givenValue == enumType.getValue()) { |
|
43 |
return enumType.getNote(); |
|
44 |
} |
|
45 |
} |
|
46 |
return null; |
|
47 |
} |
|
48 |
|
|
49 |
public static int getValueByNote(String givenNote) { |
|
50 |
for (EM_THINGS_CONDITION_TYPE enumType : EM_THINGS_CONDITION_TYPE.values()) { |
|
51 |
if (givenNote.equals(enumType.getNote())) { |
|
52 |
return enumType.getValue(); |
|
53 |
} |
|
54 |
} |
|
55 |
return -1; |
|
56 |
} |
|
57 |
|
|
58 |
public static EM_THINGS_CONDITION_TYPE getEnum(int value) { |
|
59 |
for (EM_THINGS_CONDITION_TYPE e : EM_THINGS_CONDITION_TYPE.values()) { |
|
60 |
if (e.getValue() == value) |
|
61 |
return e; |
|
62 |
} |
|
63 |
return EM_THINGS_CONDITION_TYPE.EM_THINGS_CONDITION_TYPE_UNKNOWN; |
|
64 |
} |
|
65 |
|
|
66 |
} |