Class Interval

  • All Implemented Interfaces:
    java.lang.Comparable<Schedule>

    public class Interval
    extends Schedule
    • Constructor Summary

      Constructors 
      Constructor Description
      Interval​(java.lang.String durationExpression)  
      Interval​(java.time.Duration duration)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Compares this object against the specified object.
      int hashCode()  
      java.time.Instant next​(java.time.Instant createdAtInstant, java.time.Instant currentInstant, java.time.ZoneId zoneId)
      Calculates the next occurrence based on the creation time and the provided base time.
      java.lang.String toString()  
      void validateSchedule()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Interval

        public Interval​(java.time.Duration duration)
      • Interval

        public Interval​(java.lang.String durationExpression)
    • Method Detail

      • next

        public java.time.Instant next​(java.time.Instant createdAtInstant,
                                      java.time.Instant currentInstant,
                                      java.time.ZoneId zoneId)
        Description copied from class: Schedule
        Calculates the next occurrence based on the creation time and the provided base time.
        Specified by:
        next in class Schedule
        Parameters:
        createdAtInstant - Instant object when the schedule was first created
        currentInstant - Instant object used to calculate next occurrence (normally Instant.now()).
        zoneId - the zone for which to calculate the schedule
        Returns:
        Instant of the next occurrence.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this object against the specified object. The result is true if and only if the argument is not null and is a Schedule object that whose seconds, minutes, hours, days, months, and days of weeks sets are equal to those of this schedule.

        The expression string used to create the schedule is not considered, as two different expressions may produce same schedules.

        Overrides:
        equals in class Schedule
        Parameters:
        obj - the object to compare with
        Returns:
        true if the objects are the same; false otherwise