]> git.basschouten.com Git - openhab-addons.git/blob
d8168a490221b9d01e06a4554f89d3540d0aa9a2
[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.nest.internal.wwn.dto;
14
15 import java.util.Map;
16
17 /**
18  * All the WWN devices broken up by type.
19  *
20  * @author David Bennett - Initial contribution
21  */
22 public class WWNDevices {
23
24     private Map<String, WWNThermostat> thermostats;
25     private Map<String, WWNSmokeDetector> smokeCoAlarms;
26     private Map<String, WWNCamera> cameras;
27
28     /** Id to thermostat mapping */
29     public Map<String, WWNThermostat> getThermostats() {
30         return thermostats;
31     }
32
33     /** Id to camera mapping */
34     public Map<String, WWNCamera> getCameras() {
35         return cameras;
36     }
37
38     /** Id to smoke detector */
39     public Map<String, WWNSmokeDetector> getSmokeCoAlarms() {
40         return smokeCoAlarms;
41     }
42
43     @Override
44     public boolean equals(Object obj) {
45         if (this == obj) {
46             return true;
47         }
48         if (obj == null) {
49             return false;
50         }
51         if (getClass() != obj.getClass()) {
52             return false;
53         }
54         WWNDevices other = (WWNDevices) obj;
55         if (cameras == null) {
56             if (other.cameras != null) {
57                 return false;
58             }
59         } else if (!cameras.equals(other.cameras)) {
60             return false;
61         }
62         if (smokeCoAlarms == null) {
63             if (other.smokeCoAlarms != null) {
64                 return false;
65             }
66         } else if (!smokeCoAlarms.equals(other.smokeCoAlarms)) {
67             return false;
68         }
69         if (thermostats == null) {
70             if (other.thermostats != null) {
71                 return false;
72             }
73         } else if (!thermostats.equals(other.thermostats)) {
74             return false;
75         }
76         return true;
77     }
78
79     @Override
80     public int hashCode() {
81         final int prime = 31;
82         int result = 1;
83         result = prime * result + ((cameras == null) ? 0 : cameras.hashCode());
84         result = prime * result + ((smokeCoAlarms == null) ? 0 : smokeCoAlarms.hashCode());
85         result = prime * result + ((thermostats == null) ? 0 : thermostats.hashCode());
86         return result;
87     }
88
89     @Override
90     public String toString() {
91         StringBuilder builder = new StringBuilder();
92         builder.append("NestDevices [thermostats=").append(thermostats).append(", smokeCoAlarms=").append(smokeCoAlarms)
93                 .append(", cameras=").append(cameras).append("]");
94         return builder.toString();
95     }
96 }