Module tvbrowser
Package tvdataservice

Class MutableChannelDayProgram

  • All Implemented Interfaces:
    ChannelDayProgram

    public class MutableChannelDayProgram
    extends java.lang.Object
    implements ChannelDayProgram
    A list of the programs of one channel and one day.

    This implementation is mutable, meaning you can add programs. These programs are automatically sorted by time.

    Author:
    Til Schneider, www.murfman.de
    • Constructor Detail

      • MutableChannelDayProgram

        public MutableChannelDayProgram​(Date date,
                                        Channel channel)
        Creates a new instance of MutableChannelDayProgram.
        Parameters:
        date - The date
        channel - The channel
    • Method Detail

      • getChannel

        public Channel getChannel()
        Returns the channel of this day program.
        Specified by:
        getChannel in interface ChannelDayProgram
        Returns:
        the channel of this day program.
      • getDate

        public Date getDate()
        Returns the date of this day program.
        Specified by:
        getDate in interface ChannelDayProgram
        Returns:
        the date of this day program.
      • getProgram

        public Program getProgram​(java.lang.String progID)
        Description copied from interface: ChannelDayProgram
        Returns the first program object having the specified ID.
        Specified by:
        getProgram in interface ChannelDayProgram
        Parameters:
        progID - The ID of the wanted program.
        Returns:
        the program object having the specified ID.
      • getPrograms

        public Program[] getPrograms​(java.lang.String progID)
        Description copied from interface: ChannelDayProgram
        Returns all program objects having the specified ID. (Well this is stupid but if programs start at the same time on the same channel on the same date they have the same id.)
        Specified by:
        getPrograms in interface ChannelDayProgram
        Parameters:
        progID - The ID of the wanted programs.
        Returns:
        The array with the program objects having the specified ID.
      • getProgramCount

        public int getProgramCount()
        Gets the number of programs in this list.
        Specified by:
        getProgramCount in interface ChannelDayProgram
        Returns:
        the number of programs.
      • getProgramAt

        public Program getProgramAt​(int index)
        Returns the program at the specified index.
        Specified by:
        getProgramAt in interface ChannelDayProgram
        Parameters:
        index - The index of the wanted program.
        Returns:
        The program at the specified index.
      • addProgram

        public void addProgram​(Program program)
        Adds a program.
        Parameters:
        program - The program to add. This program will automatically be put in the right position in the list, so the list stays ordered.
      • removeAllPrograms

        public void removeAllPrograms()
        Removes all programs from this day program.
      • getPrograms

        public java.util.Iterator<Program> getPrograms()
        Returns an iterator containing all programs. Each iterator item is a devplugin.Program object.
        Specified by:
        getPrograms in interface ChannelDayProgram
        Returns:
        An iterator through the program list.
      • isComplete

        public boolean isComplete()
        Returns whether this channel day program is complete.

        Return true if the last program ends after midnight. Future implementations may check for gaps too.

        Specified by:
        isComplete in interface ChannelDayProgram
        Returns:
        true if the last program ends afer midnight. Future implementations may check for gaps too.
      • setLastProgramHadEndOnUpdate

        public void setLastProgramHadEndOnUpdate​(boolean value)
        Sets the last program end time state on data update.
        Parameters:
        value - the last program end time on data update
        Since:
        2.2
      • getLastProgramHadEndOnUpdate

        public boolean getLastProgramHadEndOnUpdate()
        Gets the last program end time state on data update.
        Specified by:
        getLastProgramHadEndOnUpdate in interface ChannelDayProgram
        Returns:
        If the last program had end time on data update
        Since:
        2.2
      • setWasChangedByPlugin

        public void setWasChangedByPlugin()
        Sets the changed state to let the day program be saved again to take over the changes. This works only if called from devplugin.Plugin#handleTvDataAdded(ChannelDayProgram) otherwise the changes won't be saved.
        Since:
        2.2.2
      • getAndResetChangedByPluginState

        public boolean getAndResetChangedByPluginState()
        Get if the day program was changed by a plugin and reset the changed state.
        Returns:
        If this day program was changed by a plugin.
        Since:
        2.2.2
      • equals

        public boolean equals​(ChannelDayProgram dayProgram)
        Compare with the given dayProgram
        Parameters:
        dayProgram - The day program.
        Returns:
        true, if all programs of the day match (with each field)
        Since:
        2.6