1 /***
2 * Java DAB EPG API - Serialize/Deserialize To/From POJOs to XML/Binary as per
3 * ETSI specifications TS 102 818 (XML Specification for DAB EPG) and TS 102
4 * 371 (Transportation and Binary Encoding Specification for EPG).
5 *
6 * Copyright (C) 2007 GCap Media PLC
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 package com.gcapmedia.dab.epg;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 /***
28 * Represents a group of short, medium and long names where
29 * medium name must occur at least once.
30 */
31 public class NameGroup {
32
33 /***
34 * Group short names
35 */
36 private List<ShortName> shortNames;
37
38 /***
39 * Group medium names
40 */
41 private List<MediumName> mediumNames;
42
43 /***
44 * Group long names
45 */
46 private List<LongName> longNames;
47
48 /***
49 * Create a new name group
50 */
51 public NameGroup() {
52 shortNames = new ArrayList<ShortName>();
53 mediumNames = new ArrayList<MediumName>();
54 longNames = new ArrayList<LongName>();
55 }
56
57 /***
58 * @return Returns whether any short names are defined
59 * in this group
60 */
61 public boolean hasShortNames() {
62 return shortNames.size() > 0;
63 }
64
65 /***
66 * Adds a short name to this group
67 * @param name Short name to add
68 */
69 public void addShortName(String name) {
70 addShortName(new ShortName(name));
71 }
72
73 /***
74 * Adds a short name to this group
75 * @param name Short name to add
76 */
77 public void addShortName(ShortName name) {
78 shortNames.add(name);
79 }
80
81 /***
82 * @return Returns all short names in this group
83 */
84 public List<ShortName> getShortNames() {
85 return shortNames;
86 }
87
88 /***
89 * @return Returns whether any medium names are defined
90 * in this group
91 */
92 public boolean hasMediumNames() {
93 return mediumNames.size() > 0;
94 }
95
96 /***
97 * Adds a medium name to this group
98 * @param name Medium name to add
99 */
100 public void addMediumName(String name) {
101 addMediumName(new MediumName(name));
102 }
103
104 /***
105 * Adds a medium name to this group
106 * @param name Medium name to add
107 */
108 public void addMediumName(MediumName name) {
109 mediumNames.add(name);
110 }
111
112 /***
113 * @return Returns all medium names in this group
114 */
115 public List<MediumName> getMediumNames() {
116 return mediumNames;
117 }
118
119 /***
120 * @return Returns whether any long names are defined
121 * in this group
122 */
123 public boolean hasLongNames() {
124 return longNames.size() > 0;
125 }
126
127 /***
128 * Adds a long name to this group
129 * @param name Long name to add
130 */
131 public void addLongName(String name) {
132 addLongName(new LongName(name));
133 }
134
135 /***
136 * Adds a long name to this group
137 * @param name Long name to add
138 */
139 public void addLongName(LongName name) {
140 longNames.add(name);
141 }
142
143 /***
144 * @return Returns all long names in this group
145 */
146 public List<LongName> getLongNames() {
147 return longNames;
148 }
149
150
151 }