Interface PeriodFunctionCalculator


  • public interface PeriodFunctionCalculator
    Interface to a computable temporal interval. When writing a custom period function, please note the following: The dispatcher processes all jobs using the same instance of the period function. This means that the same period function will be called with different parameters. Therefore, you have to be very careful when storing values inside the period function. Parameter values can be cached to increase performance, but you must test every time that the parameter values have not changed.
    • Method Detail

      • nextPotentialStatusChange

        DateTimeZone nextPotentialStatusChange​(DateTimeZone startTime,
                                               DateTimeZone endTime,
                                               TimeZone timeZone,
                                               Properties parameters)
                                        throws com.redwood.scheduler.api.exception.SchedulerAPIException
        see TimeWindowIntervalMethod#nextPotentialStatusChange(DateTimeZone,DateTimeZone)
        Parameters:
        parameters - parameters specific for this period function
        startTime - time to look from
        endTime - timestamp to look up to
        timeZone - time zone to work in
        Returns:
        a timestamp of the next potential status change AFTER the startTime
        Throws:
        com.redwood.scheduler.api.exception.SchedulerAPIException
      • isOpen

        boolean isOpen​(DateTimeZone atTime,
                       TimeZone timeZone,
                       Properties parameters)
                throws com.redwood.scheduler.api.exception.SchedulerAPIException
        see TimeWindowIntervalMethod#isOpen(DateTimeZone)
        Parameters:
        timeZone - time zone of the TimeWindowInterval
        atTime - timestamp to check
        parameters - parameters specific for this period function
        Returns:
        true if it is open at atTime
        Throws:
        com.redwood.scheduler.api.exception.SchedulerAPIException
      • validate

        void validate​(Properties parameters)
        Throws runtime exception if the parameters are not valid for this period function
        Parameters:
        parameters - parameters specific for this period function
      • description

        String description​(Properties parameters)
        Human-readable (and understandable) description of this function
        Parameters:
        parameters - parameters specific for this period function
        Returns:
        human-readable (and understandable) description of this function