提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
public enum EM_DRIVING_DIRECTION { |
|
4 |
|
|
5 |
/** |
|
6 |
* 未知 |
|
7 |
*/ |
|
8 |
EM_DRIVING_DIRECTION_UNKNOWN(0,"未知"), |
|
9 |
/** |
|
10 |
* 驶入 |
|
11 |
*/ |
|
12 |
EM_DRIVING_DIRECTION_IN(1,"驶入"), |
|
13 |
/** |
|
14 |
* 驶出 |
|
15 |
*/ |
|
16 |
EM_DRIVING_DIRECTION_OUT(2,"驶出"); |
|
17 |
|
|
18 |
private int value; |
|
19 |
private String note; |
|
20 |
|
|
21 |
private EM_DRIVING_DIRECTION(int givenValue, String note) { |
|
22 |
this.value = givenValue; |
|
23 |
this.note = note; |
|
24 |
} |
|
25 |
|
|
26 |
public String getNote() { |
|
27 |
return note; |
|
28 |
} |
|
29 |
|
|
30 |
public int getValue() { |
|
31 |
return value; |
|
32 |
} |
|
33 |
|
|
34 |
public static String getNoteByValue(int givenValue) { |
|
35 |
for (EM_DRIVING_DIRECTION enumType : EM_DRIVING_DIRECTION.values()) { |
|
36 |
if (givenValue == enumType.getValue()) { |
|
37 |
return enumType.getNote(); |
|
38 |
} |
|
39 |
} |
|
40 |
return null; |
|
41 |
} |
|
42 |
|
|
43 |
public static int getValueByNote(String givenNote) { |
|
44 |
for (EM_DRIVING_DIRECTION enumType : EM_DRIVING_DIRECTION.values()) { |
|
45 |
if (givenNote.equals(enumType.getNote()) ) { |
|
46 |
return enumType.getValue(); |
|
47 |
} |
|
48 |
} |
|
49 |
return -1; |
|
50 |
} |
|
51 |
} |