提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
public enum EM_CB_STATES { |
|
4 |
EM_CB_STATES_UNKNOWN(0,"Unknown"), // "Unknown" |
|
5 |
EM_CB_STATES_CREATED(1,"Created"), // "Created" |
|
6 |
EM_CB_STATES_READY(2,"Ready"), // "Ready" |
|
7 |
EM_CB_STATES_RUNNING(3,"Running"), // "Running" |
|
8 |
EM_CB_STATES_FINISHED(4,"Finished"), // "Finished" |
|
9 |
EM_CB_STATES_ERROR(5,"Error"), // "Error" |
|
10 |
EM_CB_STATES_ABORTED(6,"Aborted"), // "Aborted" |
|
11 |
EM_CB_STATES_PAUSE(7,"Pause"); // "Pause" |
|
12 |
|
|
13 |
|
|
14 |
private int value; |
|
15 |
private String note; |
|
16 |
|
|
17 |
private EM_CB_STATES(int givenValue, String note) { |
|
18 |
this.value = givenValue; |
|
19 |
this.note = note; |
|
20 |
} |
|
21 |
|
|
22 |
public String getNote() { |
|
23 |
return note; |
|
24 |
} |
|
25 |
|
|
26 |
public int getValue() { |
|
27 |
return value; |
|
28 |
} |
|
29 |
|
|
30 |
public static String getNoteByValue(int givenValue) { |
|
31 |
for (EM_TRAFFICSTROBE_STATUS enumType : EM_TRAFFICSTROBE_STATUS.values()) { |
|
32 |
if (givenValue == enumType.getValue()) { |
|
33 |
return enumType.getNote(); |
|
34 |
} |
|
35 |
} |
|
36 |
return null; |
|
37 |
} |
|
38 |
|
|
39 |
public static int getValueByNote(String givenNote) { |
|
40 |
for (EM_TRAFFICSTROBE_STATUS enumType : EM_TRAFFICSTROBE_STATUS.values()) { |
|
41 |
if (givenNote.equals(enumType.getNote())) { |
|
42 |
return enumType.getValue(); |
|
43 |
} |
|
44 |
} |
|
45 |
return -1; |
|
46 |
} |
|
47 |
} |