]> git.basschouten.com Git - openhab-addons.git/blob
ec660f6d23265787ae13a146f9e2207edbc8ea39
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.epsonprojector.internal.enums;
14
15 import java.util.Arrays;
16 import java.util.NoSuchElementException;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19
20 /**
21  * Valid values for AspectRatio.
22  *
23  * @author Pauli Anttila - Initial contribution
24  * @author Yannick Schaus - Refactoring
25  * @author Michael Lobstein - Improvements for OH3
26  */
27 @NonNullByDefault
28 public enum AspectRatio {
29     NORMAL(0x00),
30     RATIO4X3(0x10),
31     ZOOM4X3(0x12),
32     RATIO16X9(0x20),
33     UP16X9(0x21),
34     DOWN16X9(0x22),
35     AUTO(0x30),
36     FULL(0x40),
37     ZOOM(0x50),
38     REAL(0x60),
39     WIDE(0x70),
40     ANAMORPHIC(0x80),
41     SQUEEZE(0x90),
42     UNKNOWN(0xFF);
43
44     private final int value;
45
46     AspectRatio(int value) {
47         this.value = value;
48     }
49
50     public static AspectRatio forValue(int value) {
51         try {
52             return Arrays.stream(values()).filter(e -> e.value == value).findFirst().get();
53         } catch (NoSuchElementException e) {
54             return UNKNOWN;
55         }
56     }
57
58     public int toInt() {
59         return value;
60     }
61 }