View Javadoc

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.Collection;
26  import java.util.Collections;
27  import java.util.List;
28  
29  /***
30   *  <p>
31   *  Describes the time information and the location in the DAB channel of
32   *  a programme. There may be:
33   *  
34   *  <ul>
35   *    <li>One time and one bearer</li>
36   *    <li>One time and multiple bearers</li>
37   *    <li>One bearer and multiple times</li>
38   *  </ul>
39   *  
40   *  Multiple time properties and multiple bearers is ambiguous and must 
41   *  not be used. If the EPG data service is associated with an audio service
42   *  (i.e. PAD within DAB) and the <b>bearer</b> element is not present then
43   *  the programme information releates to that associated audio service.
44   *  </p>
45   *  
46   *  <p>
47   *  The <b>time</b> property describes the time information for a programme.
48   *  Either as absolute or relative. Relative time should only be used for
49   *  nested programme events.
50   *  </p>
51   */
52  public class Location {
53  
54  	/***
55  	 * Programme times
56  	 */
57  	private List<Time> times;
58  	
59  	/***
60  	 * Relative times
61  	 */
62  	private List<RelativeTime> relativeTimes;
63  	
64  	/***
65  	 * DAB channel bearer
66  	 */
67  	private List<Bearer> bearers;
68  	
69  	/***
70  	 * Create a new location
71  	 */
72  	public Location() {
73  		times = new ArrayList<Time>();
74  		relativeTimes = new ArrayList<RelativeTime>();
75  		bearers = new ArrayList<Bearer>();
76  	}
77  	
78  	/***
79  	 * @return Returns the timing information of this lcoation
80  	 */
81  	public Collection<Time> getTimes() {
82  		return Collections.unmodifiableCollection(times);
83  	}
84  	
85  	/***
86  	 * Adds a time to the location
87  	 * @param time Programme time to add
88  	 */
89  	public void addTime(Time time) {
90  		times.add(time);
91  	}
92  	
93  	/***
94  	 * @return Returns the relative time information of this location
95  	 */
96  	public Collection<RelativeTime> getRelativeTimes() {
97  		return Collections.unmodifiableCollection(relativeTimes);
98  	}
99  	
100 	/***
101 	 * Adds a relative time to the location
102 	 * @param relativeTimes Programme relative time to add
103 	 */
104 	public void addRelativeTime(RelativeTime relativeTime) {
105 		relativeTimes.add(relativeTime);
106 	}
107 	
108 	/***
109 	 * @return Returns the bearers set against this location
110 	 */
111 	public Collection<Bearer> getBearers() {
112 		return Collections.unmodifiableCollection(bearers);
113 	}
114 	
115 	/***
116 	 * Adds a bearer to the location
117 	 * @param bearer Bearer to add
118 	 */
119 	public void addBearer(Bearer bearer) {
120 		bearers.add(bearer);
121 	}
122 	
123 }