| /* |
| * Copyright (c) 2017 CEA. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * CEA - initial API and implementation |
| */ |
| package org.eclipse.sensinact.gateway.device.openhab.common; |
| |
| import java.util.HashSet; |
| import java.util.Set; |
| |
| public class Broker { |
| |
| private final ServerLocation server; |
| private final Set<String> devices = new HashSet<String>(); |
| |
| public Broker(ServerLocation server) { |
| this.server = server; |
| } |
| |
| public ServerLocation getServer() { |
| return server; |
| } |
| |
| public Set<String> getDevices() { |
| return devices; |
| } |
| |
| @Override |
| public int hashCode() { |
| final int prime = 31; |
| int result = 1; |
| result = prime * result + ((devices == null) ? 0 : devices.hashCode()); |
| result = prime * result + ((server == null) ? 0 : server.hashCode()); |
| return result; |
| } |
| |
| @Override |
| public boolean equals(Object obj) { |
| if (this == obj) |
| return true; |
| if (obj == null) |
| return false; |
| if (getClass() != obj.getClass()) |
| return false; |
| Broker other = (Broker) obj; |
| if (devices == null) { |
| if (other.devices != null) |
| return false; |
| } else if (!devices.equals(other.devices)) |
| return false; |
| if (server == null) { |
| if (other.server != null) |
| return false; |
| } else if (!server.equals(other.server)) |
| return false; |
| return true; |
| } |
| |
| @Override |
| public String toString() { |
| return "Broker [server=" + server + ", devices=" + devices + "]"; |
| } |
| } |