bbc.rd.tvanytime.programLocation
Class ProgramLocationTable

java.lang.Object
  extended by bbc.rd.tvanytime.programLocation.ProgramLocationTable
All Implemented Interfaces:
LocationResolution, java.lang.Cloneable

public class ProgramLocationTable
extends java.lang.Object
implements LocationResolution, java.lang.Cloneable

ProgramLocationTable: Represents a table that contains Schedule objects.

Version:
1.0 Modified T.Ferne, BBC R&D, February 2004 Modified T.Ferne, BBC R&D, 26/4/04: Added getScheduleAsEvents() method.
Author:
Tim Sargeant, BBC Research & Development, April 2002

Constructor Summary
ProgramLocationTable()
          Constructor for objects of type ProgramLocationTable
 
Method Summary
 void addSchedule(Schedule schedule)
          Adds a Schedule object
 java.lang.Object clone()
          Clones itself.
 int getNumSchedules()
          Get the number of Schedule objects belonging to this ProgramLocationTable
 java.util.Vector getSchedule(java.util.Date startTime, java.util.Date endTime)
          Returns vector of CRIDs for all events that start at a time between the start time and the end time.
 java.util.Vector getSchedule(java.util.Date startTime, java.util.Date endTime, java.lang.String serviceID)
          Returns vector of CRIDs for all events that start at a time between the start time and the end time and are on the specified service.
 Schedule getSchedule(int index)
          Gets a Schedule object (note this is different to the other getSchedule() methods in this object)
 java.util.Vector getScheduleAsEvents(java.util.Date startTime, java.util.Date endTime, java.lang.String serviceID)
          Returns vector of ScheduleEvents for all events that start at a time between the start time and the end time and are on the specified service.
 java.util.Vector getScheduleEvent(ContentReference crid)
          Returns all ScheduleEvents that match this CRID.
 void removeAll()
          Removes all Schedule objects
 java.util.Vector resolveLeafCRID(ContentReference crid)
          Returns vector of BroadcastURLs with this CRID.
 java.util.Vector resolveLeafCRID(ContentReference crid, java.lang.String serviceID)
          Returns vector of BroadcastURLs with this CRID on the specified service.
 java.lang.String toString()
          Returns string representation of this table.
 java.lang.String toString(int indent)
          Returns string representation of this table.
 java.lang.String toXML()
          Returns XML representation of this table.
 java.lang.String toXML(int indent)
          Returns XML representation of this table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgramLocationTable

public ProgramLocationTable()
Constructor for objects of type ProgramLocationTable

Method Detail

getNumSchedules

public int getNumSchedules()
Get the number of Schedule objects belonging to this ProgramLocationTable

Returns:
the number of Schedule objects

getSchedule

public Schedule getSchedule(int index)
Gets a Schedule object (note this is different to the other getSchedule() methods in this object)

Parameters:
index - the index to the Schedule object
Returns:
the Schedule object, or null if no Schedule objects exist

addSchedule

public void addSchedule(Schedule schedule)
Adds a Schedule object

Parameters:
schedule - the Schedule object

removeAll

public void removeAll()
Removes all Schedule objects


resolveLeafCRID

public java.util.Vector resolveLeafCRID(ContentReference crid)
Returns vector of BroadcastURLs with this CRID.

Specified by:
resolveLeafCRID in interface LocationResolution
Parameters:
crid - CRID to search for.
Returns:
Vector of BroadcastURLs for this CRID.

resolveLeafCRID

public java.util.Vector resolveLeafCRID(ContentReference crid,
                                        java.lang.String serviceID)
Returns vector of BroadcastURLs with this CRID on the specified service.

Specified by:
resolveLeafCRID in interface LocationResolution
Parameters:
crid - CRID to search for.
serviceID - The serviceID of the service we are interested in.
Returns:
Vector of all BroadcastURLs.

getSchedule

public java.util.Vector getSchedule(java.util.Date startTime,
                                    java.util.Date endTime)
Returns vector of CRIDs for all events that start at a time between the start time and the end time.
(Note, this has different functionality to the getSchedule(int index) method in this object)
This implementation returns CRIDS of programmes which are showing between start and end times. (eg. if startTime = 22:04, the crid of a news programme which started at 22:00 will be returned. Similarly, the crid of programmes showing at the endTime will be returned.)
This method searches on the ScheduleEvent's optional 'publishedTime'. If publishedTime is not present for a particular CRID, the CRID will not be returned. If the optional 'publishedDuration' is not set, it is assumed to be zero.

Specified by:
getSchedule in interface LocationResolution
Parameters:
startTime - Start time of schedule.
endTime - End time of schedule.
Returns:
Vector of all ContentReferences in this time period.

getSchedule

public java.util.Vector getSchedule(java.util.Date startTime,
                                    java.util.Date endTime,
                                    java.lang.String serviceID)
Returns vector of CRIDs for all events that start at a time between the start time and the end time and are on the specified service.
(Note, this has different functionality to the getSchedule(int index) method in this object)
This implementation returns CRIDS of programmes which are showing between start and end times. (eg. if startTime = 22:04, the crid of a news programme which started at 22:00 will be returned. Similarly, the crid of programmes showing at the endTime will be returned.)
This method searches on the ScheduleEvent's optional 'publishedTime'. If publishedTime is not present for a particular CRID, the CRID will not be returned. If the optional 'publishedDuration' is not set, it is assumed to be zero.

Specified by:
getSchedule in interface LocationResolution
Parameters:
startTime - Start time of schedule.
endTime - End time of schedule.
serviceID - The serviceID of the service we are interested in.
Returns:
Vector of all ContentReferences on this service in this time period.

getScheduleAsEvents

public java.util.Vector getScheduleAsEvents(java.util.Date startTime,
                                            java.util.Date endTime,
                                            java.lang.String serviceID)
Returns vector of ScheduleEvents for all events that start at a time between the start time and the end time and are on the specified service.
This is the same functionality as getSchedule(startTime, endTime, serviceID).
This implementation returns CRIDS of programmes which are showing between start and end times. (eg. if startTime = 22:04, the crid of a news programme which started at 22:00 will be returned. Similarly, the crid of programmes showing at the endTime will be returned.)
This method searches on the ScheduleEvent's optional 'publishedTime'. If publishedTime is not present for a particular CRID, the CRID will not be returned. If the optional 'publishedDuration' is not set, it is assumed to be zero.

Parameters:
startTime - Start time of schedule.
endTime - End time of schedule.
serviceID - The serviceID of the service we are interested in.
Returns:
Vector of all ScheduleEvents on this service in this time period.

getScheduleEvent

public java.util.Vector getScheduleEvent(ContentReference crid)
                                  throws SearchInterfaceNotSupportedException
Returns all ScheduleEvents that match this CRID. Note: This is a very slow implementation that searches through all the events in all the schedules sequentially. Could be made more efficient by caching ScheduleEvents in a hashtable.

Parameters:
crid - CRID of programme to search for.
Returns:
A Vector of ScheduleEvents that match the CRID.
Throws:
SearchInterfaceNotSupportedException - If the implementation doesn't support this function.

toXML

public java.lang.String toXML()
Returns XML representation of this table.

Returns:
XML representation of this table.

toXML

public java.lang.String toXML(int indent)
Returns XML representation of this table.

Parameters:
indent - Number of tabs with which to indent the string.
Returns:
XML representation of the table.

toString

public java.lang.String toString()
Returns string representation of this table.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this table.

toString

public java.lang.String toString(int indent)
Returns string representation of this table.

Parameters:
indent - number of tabs to put before the string.
Returns:
string representation of this table.

clone

public java.lang.Object clone()
Clones itself.

Overrides:
clone in class java.lang.Object
Returns:
A copy of itself.