Class MinuteFrequency


  • public class MinuteFrequency
    extends Frequency
    Allows specification of a schedule with a frequency measured in minutes. This is an "anyTime" frequency, meaning that only the frequency of of the scheduling is specified, without any constraint on the actual walltime. (This is because the additional constraints don't make sense for minute frequencies. E.g. you can have a frequency "Every day at 6pm" but how would you complete "Every 17 minutes at ???"?)
    • Constructor Summary

      Constructors 
      Constructor Description
      MinuteFrequency​(int numMinutes)
      Constructor specifying the number of minutes between runs scheduled with this frequency.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(Object o)
      Autogenerated equals.
      Date getFirstEvent​(Date startTime)
      As this is an "anyTime" frequency, this method just returns its argument (so long as it is not null).
      Date getNextEvent​(Date lastEvent)
      This method returns the time of the next event, which is just the value of lastEvent+(numMinutes)Minutes
      Integer getOnDayOfMonth()
      Return the exact day of month event should happen on, or null if this is an anyTime event or doesn't define what day of month it should happen on.
      Integer getOnDayOfWeek()
      Return the exact day of week event should happen on, or null if this is an anyTime event or doesn't define what day of week it should happen on.
      Integer getOnHour()
      Return the exact hour event should happen on, or null if this is an anyTime event or doesn't define what hour it should happen on.
      Integer getOnMinute()
      Return the exact minute event should happen on, or null if this is an anyTime event or doesn't define what minute it should happen on.
      int hashCode()
      Autogenerated hashcode method.
      int ordinal()
      Return an integer that can be used to identify the kind of frequency.
    • Constructor Detail

      • MinuteFrequency

        public MinuteFrequency​(int numMinutes)
        Constructor specifying the number of minutes between runs scheduled with this frequency.
        Parameters:
        numMinutes -
    • Method Detail

      • getNextEvent

        public Date getNextEvent​(Date lastEvent)
        This method returns the time of the next event, which is just the value of lastEvent+(numMinutes)Minutes
        Specified by:
        getNextEvent in class Frequency
        Parameters:
        lastEvent - A time from which the next event should be calculated.
        Returns:
        the time of the next event.
        Throws:
        ArgumentNotValid - if lastEvent is null.
      • getFirstEvent

        public Date getFirstEvent​(Date startTime)
        As this is an "anyTime" frequency, this method just returns its argument (so long as it is not null).
        Specified by:
        getFirstEvent in class Frequency
        Parameters:
        startTime - The earliest time the event can happen.
        Returns:
        the startTime for the first event of this frequency.
        Throws:
        ArgumentNotValid - if startTime is null.
      • getOnMinute

        public Integer getOnMinute()
        Description copied from class: Frequency
        Return the exact minute event should happen on, or null if this is an anyTime event or doesn't define what minute it should happen on.
        Specified by:
        getOnMinute in class Frequency
        Returns:
        the exact minute event should happen on
      • getOnHour

        public Integer getOnHour()
        Description copied from class: Frequency
        Return the exact hour event should happen on, or null if this is an anyTime event or doesn't define what hour it should happen on.
        Specified by:
        getOnHour in class Frequency
        Returns:
        the exact hour event should happen on
      • getOnDayOfWeek

        public Integer getOnDayOfWeek()
        Description copied from class: Frequency
        Return the exact day of week event should happen on, or null if this is an anyTime event or doesn't define what day of week it should happen on.
        Specified by:
        getOnDayOfWeek in class Frequency
        Returns:
        the exact day of week event should happen on
      • getOnDayOfMonth

        public Integer getOnDayOfMonth()
        Description copied from class: Frequency
        Return the exact day of month event should happen on, or null if this is an anyTime event or doesn't define what day of month it should happen on.
        Specified by:
        getOnDayOfMonth in class Frequency
        Returns:
        the exact day of month event should happen on
      • ordinal

        public int ordinal()
        Description copied from class: Frequency
        Return an integer that can be used to identify the kind of frequency. No two subclasses should use the same integer
        Specified by:
        ordinal in class Frequency
        Returns:
        Return an integer that can be used to identify the kind of frequency
      • equals

        public boolean equals​(Object o)
        Description copied from class: Frequency
        Autogenerated equals.
        Overrides:
        equals in class Frequency
        Parameters:
        o - The object to compare with
        Returns:
        Whether objects are equal
      • hashCode

        public int hashCode()
        Description copied from class: Frequency
        Autogenerated hashcode method.
        Overrides:
        hashCode in class Frequency
        Returns:
        the hashcode