]> git.basschouten.com Git - openhab-addons.git/blob
23f697faa0bf9aa07ee8d5145a515332cbcfeca2
[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.nanoleaf.internal.model;
14
15 import java.util.Objects;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * Represents global orientation settings of the light panels
22  *
23  * @author Martin Raepple - Initial contribution
24  */
25 @NonNullByDefault
26 public class GlobalOrientation {
27
28     private int value;
29     private @Nullable Integer max;
30     private @Nullable Integer min;
31
32     public GlobalOrientation() {
33     }
34
35     public GlobalOrientation(Integer min, Integer max, int value) {
36         this.min = min;
37         this.max = max;
38         this.value = value;
39     }
40
41     public int getValue() {
42         return value;
43     }
44
45     public void setValue(int value) {
46         this.value = value;
47     }
48
49     public @Nullable Integer getMax() {
50         return max;
51     }
52
53     public void setMax(Integer max) {
54         this.max = max;
55     }
56
57     public @Nullable Integer getMin() {
58         return min;
59     }
60
61     public void setMin(Integer min) {
62         this.min = min;
63     }
64
65     @Override
66     public boolean equals(@Nullable Object o) {
67         if (this == o) {
68             return true;
69         }
70
71         if (o == null || getClass() != o.getClass()) {
72             return false;
73         }
74
75         GlobalOrientation go = (GlobalOrientation) o;
76         return (value == go.getValue()) && (Objects.equals(min, go.getMin())) && (Objects.equals(max, go.getMax()));
77     }
78
79     @Override
80     public int hashCode() {
81         final int prime = 31;
82         int result = 1;
83         Integer x = max;
84         Integer i = min;
85         result = prime * result + value;
86         result = prime * result + ((x == null) ? 0 : x.hashCode());
87         result = prime * result + ((i == null) ? 0 : i.hashCode());
88         return result;
89     }
90 }