TV-Browser 3.3.3 API

util.program
Class ProgramUtilities

java.lang.Object
  extended by util.program.ProgramUtilities

public class ProgramUtilities
extends java.lang.Object

Provides utilities for program stuff.

Author:
René Mach

Constructor Summary
ProgramUtilities()
           
 
Method Summary
static java.lang.String[] getActorNames(Program program)
          extract the actor names from the actor field
static int getAgeLimit(java.lang.String rating)
          get the age limit for a given textual rating
static java.awt.Color getColorForProgramImportance(java.awt.Color color, byte importance)
          Creates a color that uses the program importance for alpha value.
static java.awt.Color getColorForProgramImportance(java.awt.Color color, Program program)
          Creates a color that uses the program importance for alpha value.
static java.util.Iterator<Program> getJointProgramIteratorFor(Date date, Channel channel)
          Gets an iterator that contains all programs for the given date of the given channel and it's joint channel if there one or it's base channel if there one.
static java.util.Comparator<Program> getProgramComparator()
          comparator to sort programs by date, time and position in channel list
static byte getProgramImportance(Program program)
          Gets the program importance of the given program.
static java.lang.String getTimeZoneCorrectedProgramId(java.lang.String progID)
          Gets the time zone corrected program id of the given program id.
static boolean isNotInTimeRange(int timeFrom, int timeTo, Program p)
          A helper method to get if a program is not in a time range.
static boolean isOnAir(Program p)
          Helper method to check if a program runs.
static java.util.ArrayList<java.lang.String>[] splitActors(Program program)
          get the actors and roles of a program
static java.lang.String[] splitPersons(java.lang.String field)
          extract a list of person names out of the given string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgramUtilities

public ProgramUtilities()
Method Detail

isOnAir

public static boolean isOnAir(Program p)
Helper method to check if a program runs.

Parameters:
p - The program to check.
Returns:
True if the program runs.

getProgramComparator

public static java.util.Comparator<Program> getProgramComparator()
comparator to sort programs by date, time and position in channel list

Returns:
The comparator for programs.

isNotInTimeRange

public static boolean isNotInTimeRange(int timeFrom,
                                       int timeTo,
                                       Program p)
A helper method to get if a program is not in a time range.

Parameters:
timeFrom - The beginning of the time range to check
timeTo - The ending of the time range
p - The program to check
Returns:
If the program is not in the given time range.
Since:
2.2.2

splitActors

public static java.util.ArrayList<java.lang.String>[] splitActors(Program program)
get the actors and roles of a program

Parameters:
program - the program containing the actors
Returns:
array of 2 lists, where one contains roles and the other actors
Since:
2.6

getActorNames

public static java.lang.String[] getActorNames(Program program)
extract the actor names from the actor field

Parameters:
program - the program to work on
Returns:
list of real actor names or null (if it can not be decided)
Since:
2.6

getTimeZoneCorrectedProgramId

public static java.lang.String getTimeZoneCorrectedProgramId(java.lang.String progID)
Gets the time zone corrected program id of the given program id. If the current time zone is the same like the time zone of the given id the given id will be returned.

Parameters:
progID - The id to get the time zone corrected for.
Returns:
The time zone corrected program id.
Since:
2.7

splitPersons

public static java.lang.String[] splitPersons(java.lang.String field)
extract a list of person names out of the given string

Parameters:
field -
Returns:
list of person names

getAgeLimit

public static int getAgeLimit(java.lang.String rating)
get the age limit for a given textual rating

Parameters:
rating -
Returns:
age limit or -1
Since:
3.0

getColorForProgramImportance

public static java.awt.Color getColorForProgramImportance(java.awt.Color color,
                                                          Program program)
Creates a color that uses the program importance for alpha value.

Parameters:
color - The color to use for alpha value change.
program - The program to get the changed color for.
Returns:
The color that uses the program importance alpha value.
Since:
3.1

getColorForProgramImportance

public static java.awt.Color getColorForProgramImportance(java.awt.Color color,
                                                          byte importance)
Creates a color that uses the program importance for alpha value.

Parameters:
color - The color to use for alpha value change.
importance - The importance to get the changed color for.
Returns:
The color that uses the program importance alpha value.
Since:
3.1

getProgramImportance

public static byte getProgramImportance(Program program)
Gets the program importance of the given program.

Parameters:
program - The program to get the program importance for
Returns:
The program importance from 0 to 10 for the given program.
Since:
3.1

getJointProgramIteratorFor

public static java.util.Iterator<Program> getJointProgramIteratorFor(Date date,
                                                                     Channel channel)
Gets an iterator that contains all programs for the given date of the given channel and it's joint channel if there one or it's base channel if there one.

Parameters:
date - The date to get the iterator for.
channel - The channel to get the iterator for.
Returns:
An iterator of programs.
Since:
3.2.1

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)