]> git.basschouten.com Git - openhab-addons.git/blob
de0c046a9f76fbc63653759c6473e664927c5c46
[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.sonos.internal;
14
15 import java.util.ArrayList;
16 import java.util.Collection;
17 import java.util.List;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20
21 /**
22  * The {@link SonosZoneGroup} is data structure to describe
23  * Groups of Zone Players in the Sonos ecosystem
24  *
25  * @author Karel Goderis - Initial contribution
26  */
27 @NonNullByDefault
28 public class SonosZoneGroup {
29
30     private final List<String> members;
31     private List<String> memberZoneNames;
32     private final String coordinator;
33     private final String id;
34
35     public SonosZoneGroup(String id, String coordinator, Collection<String> members,
36             Collection<String> memberZoneNames) {
37         this.members = new ArrayList<>(members);
38         if (!this.members.contains(coordinator)) {
39             this.members.add(coordinator);
40         }
41         this.memberZoneNames = new ArrayList<>(memberZoneNames);
42         this.coordinator = coordinator;
43         this.id = id;
44     }
45
46     public List<String> getMembers() {
47         return members;
48     }
49
50     public List<String> getMemberZoneNames() {
51         return memberZoneNames;
52     }
53
54     public String getCoordinator() {
55         return coordinator;
56     }
57
58     public String getId() {
59         return id;
60     }
61 }