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 org.joda.time.Duration;
25  import org.joda.time.Period;
26  import org.joda.time.ReadableInstant;
27  
28  /***
29   * <p>Describes the timing information of a programme, both billed and actual.</p>
30   * 
31   * <p>For example, a programme may be billed to start at 18:00 and last 30
32   * minutes but is actually scheduled to start at 18:03 after a 3 minute news
33   * bulletin and will therefore last only 27 minutes.</p>
34   */
35  public class Time {
36  
37  	/***
38  	 * Billed programme start time
39  	 */
40  	private ReadableInstant billedTime;
41  	
42  	/***
43  	 * Billed programme duration
44  	 */
45  	private Duration billedDuration;
46  	
47  	/***
48  	 * Actual programme start time
49  	 */
50  	private ReadableInstant actualTime;
51  	
52  	/***
53  	 * Actual programme duration
54  	 */
55  	private Duration actualDuration;
56  	
57  	/***
58  	 * Create a new programme time
59  	 * @param billedTime Billed programme time
60  	 * @param billedDuration Billed programme duration
61  	 */
62  	public Time(ReadableInstant billedTime, Duration billedDuration) {
63  		this.billedTime = billedTime;
64  		this.billedDuration = billedDuration;
65  	}
66  	
67  	/***
68  	 * Create a new programme time
69  	 * @param billedTime Billed programme time
70  	 * @param billedDuration Billed programme duration
71  	 */
72  	public Time(ReadableInstant billedTime, Period period) {
73  		this.billedTime = billedTime;
74  		this.billedDuration = period.toDurationFrom(billedTime);
75  	}
76  	
77  	/***
78  	 * Create a new programme time
79  	 * @param billedTime Billed programme time
80  	 * @param billedDuration Billed programme duration
81  	 * @param actualTime Actual start time of the programme
82  	 * @param actualDuration Actual duration of the programme
83  	 */
84  	public Time(ReadableInstant billedTime, Duration billedDuration, ReadableInstant actualTime, Duration actualDuration) {
85  		this.billedTime = billedTime;
86  		this.billedDuration = billedDuration;
87  		this.actualTime = actualTime;
88  		this.actualDuration = actualDuration;
89  	}
90  	
91  	/***
92  	 * Create a new programme time
93  	 * @param billedTime Billed programme time
94  	 * @param billedDuration Billed programme duration
95  	 * @param actualTime Actual start time of the programme
96  	 * @param actualDuration Actual duration of the programme
97  	 */
98  	public Time(ReadableInstant billedTime, Period billedPeriod, ReadableInstant actualTime, Period actualPeriod) {
99  		this.billedTime = billedTime;
100 		this.billedDuration = billedPeriod.toDurationFrom(billedTime);
101 		this.actualTime = actualTime;
102 		this.actualDuration = actualPeriod.toDurationFrom(actualTime);
103 	}
104 
105 	/***
106 	 * @return Returns the actual duration of the programme
107 	 */
108 	public Duration getActualDuration() {
109 		return actualDuration;
110 	}
111 
112 	/***
113 	 * @param actualDuration Sets the actual duration of the programme
114 	 */
115 	public void setActualDuration(Duration actualDuration) {
116 		this.actualDuration = actualDuration;
117 	}
118 
119 	/***
120 	 * @return Returns the actual start time of the programme
121 	 */
122 	public ReadableInstant getActualTime() {
123 		return actualTime;
124 	}
125 
126 	/***
127 	 * @param actualTime Sets the actual start time of the programme
128 	 */
129 	public void setActualTime(ReadableInstant actualTime) {
130 		this.actualTime = actualTime;
131 	}
132 
133 	/***
134 	 * @return Returns the billed duration of the programme
135 	 */
136 	public Duration getBilledDuration() {
137 		return billedDuration;
138 	}
139 
140 	/***
141 	 * @return Returns the billed start time of the programme
142 	 */
143 	public ReadableInstant getBilledTime() {
144 		return billedTime;
145 	}
146 	
147 }