2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.hdpowerview.internal.dto;
15 import java.nio.charset.StandardCharsets;
16 import java.util.Base64;
17 import java.util.Objects;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
23 * State of a single Scene Collection, as returned by an HD PowerView Hub
25 * @author Jacob Laursen - Initial contribution
28 public class SceneCollection implements Comparable<SceneCollection> {
30 public @Nullable String name;
36 public boolean equals(@Nullable Object o) {
40 if (!(o instanceof SceneCollection)) {
43 SceneCollection other = (SceneCollection) o;
45 return this.id == other.id && Objects.equals(name, other.name) && this.order == other.order
46 && this.colorId == other.colorId && this.iconId == other.iconId;
50 public final int hashCode() {
53 String name = this.name;
54 result = prime * result + id;
55 result = prime * result + (name == null ? 0 : name.hashCode());
56 result = prime * result + order;
57 result = prime * result + colorId;
58 result = prime * result + iconId;
64 public int compareTo(SceneCollection other) {
65 return Integer.compare(order, other.order);
68 public String getName() {
69 return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);