houzhongjian
2024-10-30 a28ca3f36d0ace05966a8c0fac1e4b5fe921f882
提交 | 用户 | 时间
ce910c 1 package com.netsdk.lib.enumeration;
H 2
3 /**
4  * 画质
5  *
6  * @author 47040
7  * @since Created at 2021/5/26 22:25
8  */
9 public enum NET_EM_IMAGE_QUALITY {
10
11     EM_IMAGE_QUALITY_Q10(1, "图像质量10%"),
12     EM_IMAGE_QUALITY_Q30(2, "图像质量30%"),
13     EM_IMAGE_QUALITY_Q50(3, "图像质量50%"),
14     EM_IMAGE_QUALITY_Q60(4, "图像质量60%"),
15     EM_IMAGE_QUALITY_Q80(5, "图像质量80%"),
16     EM_IMAGE_QUALITY_Q100(6, "图像质量100%");
17
18     private final int value;
19     private final String note;
20
21     NET_EM_IMAGE_QUALITY(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 (NET_EM_IMAGE_QUALITY enumType : NET_EM_IMAGE_QUALITY.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 (NET_EM_IMAGE_QUALITY enumType : NET_EM_IMAGE_QUALITY.values()) {
45             if (givenNote.equals(enumType.getNote())) {
46                 return enumType.getValue();
47             }
48         }
49         return -1;
50     }
51
52     public static NET_EM_IMAGE_QUALITY getEnum(int value) {
53         for (NET_EM_IMAGE_QUALITY e : NET_EM_IMAGE_QUALITY.values()) {
54             if (e.getValue() == value)
55                 return e;
56         }
57         return NET_EM_IMAGE_QUALITY.EM_IMAGE_QUALITY_Q10;
58     }
59 }