Class ScheduleInfo

java.lang.Object
com.groiss.timer.ScheduleInfo

public class ScheduleInfo extends Object
Define a schedule in a cron-like syntax.
  • Constructor Details

    • ScheduleInfo

      public ScheduleInfo(String pattern, Date firsttime)
      Create the schedule info object.
      Parameters:
      pattern - a pattern in cron-syntax (see system adminstration guide, section Timer, for details) or an integer (as String object) defining the interval in seconds.
      firsttime - the start of the schedule (may be null).
  • Method Details

    • setFirstTime

      public void setFirstTime(Date firsttime)
      Set the start time of the schedule.
      Parameters:
      firsttime - a date object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNextRun

      public Date getNextRun()
      Compute the next run of this schedule. Calls getNextRun(Date) with the current date.
      Returns:
      the next schedule match, null if no schedule defined
    • getNextRun

      public Date getNextRun(Date date)
      Compute the next run of this schedule. It returns the first match of the pattern after timestamp x, where x is: If firsttime is not set or in past, use the argument date, else use firsttime.
      Parameters:
      date - a date object
      Returns:
      the next schedule match, null if no schedule defined