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.yamahareceiver.internal.state;
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Objects;
20 * The preset state containing the channel names and currently selected channel
22 * @author David Graeff - Initial contribution
23 * @author Tomasz Maruszak - RX-V3900 compatibility improvements
25 public class PresetInfoState implements Invalidateable {
26 public static class Preset {
27 private final String name;
28 private final int value;
30 public Preset(String name, int value) {
35 public String getName() {
39 public int getValue() {
44 public boolean equals(Object o) {
48 if (o == null || getClass() != o.getClass()) {
51 Preset preset = (Preset) o;
52 return value == preset.value && Objects.equals(name, preset.name);
56 public int hashCode() {
57 return Objects.hash(name, value);
61 public int presetChannel = 0; // Used by NET_RADIO, RADIO, HD_RADIO, iPOD, USB, PC
62 public final List<Preset> presetChannelNames = new ArrayList<>();
63 public boolean presetChannelNamesChanged = false;
66 public void invalidate() {
68 presetChannelNames.clear();