]> git.basschouten.com Git - openhab-addons.git/blob
c6a6eae9d800fb202325d19caa02864303231faa
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.digitalstrom.internal.lib.climate.datatypes;
14
15 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum;
16
17 /**
18  * The {@link AssignSensorType} assigns a sensor type of a zone to the dSUID of the sensor-device.
19  *
20  * @author Michael Ochel - Initial contribution
21  * @author Matthias Siegele - Initial contribution
22  */
23 public class AssignSensorType {
24
25     private final SensorEnum sensorType;
26     private final String dsuid;
27
28     /**
29      * Create a new {@link AssignSensorType}.
30      *
31      * @param sensorType must not be null
32      * @param dSUID must not be null
33      */
34     public AssignSensorType(SensorEnum sensorType, String dSUID) {
35         this.sensorType = sensorType;
36         dsuid = dSUID;
37     }
38
39     /**
40      * Returns the sensor type as {@link SensorEnum}.
41      *
42      * @return the sensor type
43      */
44     public SensorEnum getSensorType() {
45         return sensorType;
46     }
47
48     /**
49      * Returns the dSUID of the assign sensor-device.
50      *
51      * @return the dSUID
52      */
53     public String getDSUID() {
54         return dsuid;
55     }
56
57     /*
58      * (non-Javadoc)
59      *
60      * @see java.lang.Object#toString()
61      */
62     @Override
63     public String toString() {
64         return "AssignSensorType [SENSOR_TYPE=" + sensorType + ", dSUID=" + dsuid + "]";
65     }
66
67     /*
68      * (non-Javadoc)
69      * 
70      * @see java.lang.Object#hashCode()
71      */
72     @Override
73     public int hashCode() {
74         final int prime = 31;
75         int result = 1;
76         result = prime * result + ((dsuid == null) ? 0 : dsuid.hashCode());
77         result = prime * result + ((sensorType == null) ? 0 : sensorType.hashCode());
78         return result;
79     }
80
81     /*
82      * (non-Javadoc)
83      * 
84      * @see java.lang.Object#equals(java.lang.Object)
85      */
86     @Override
87     public boolean equals(Object obj) {
88         if (this == obj) {
89             return true;
90         }
91         if (obj == null) {
92             return false;
93         }
94         if (!(obj instanceof AssignSensorType)) {
95             return false;
96         }
97         AssignSensorType other = (AssignSensorType) obj;
98         if (dsuid == null) {
99             if (other.dsuid != null) {
100                 return false;
101             }
102         } else if (!dsuid.equals(other.dsuid)) {
103             return false;
104         }
105         if (sensorType != other.sensorType) {
106             return false;
107         }
108         return true;
109     }
110 }