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