- java.lang.Object
-
- util.program.ProgramUtilities
-
public class ProgramUtilities extends java.lang.Object
Provides utilities for program stuff.- Author:
- René Mach
-
-
Constructor Summary
Constructors Constructor Description ProgramUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getActorNames(Program program)
extract the actor names from the actor fieldstatic int
getAgeLimit(java.lang.String rating)
get the age limit for a given textual ratingstatic 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.ArrayList<Program>
getJointProgramListForYesterdayTodayTomorrow(Date today, Channel channel, boolean excludeExpired)
Gets combined day program for yesterday, today and tomorrow.static java.util.Comparator<Program>
getProgramComparator()
comparator to sort programs by date, time and position in channel liststatic 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 programstatic java.lang.String[]
splitPersons(java.lang.String field)
extract a list of person names out of the given string
-
-
-
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 checktimeTo
- The ending of the time rangep
- 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
- The 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
- The 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
-
getJointProgramListForYesterdayTodayTomorrow
public static java.util.ArrayList<Program> getJointProgramListForYesterdayTodayTomorrow(Date today, Channel channel, boolean excludeExpired)
Gets combined day program for yesterday, today and tomorrow.- Parameters:
today
- The date of today.channel
- The channel to get the programs forexcludeExpired
- If expired programs should be excluded- Returns:
- An ArrayList with the found programs.
- Since:
- 3.4.1
-
-