Class RepeatingSchedule

    • Constructor Detail

      • RepeatingSchedule

        public RepeatingSchedule​(Date startDate,
                                 int repeats,
                                 Frequency frequency,
                                 String name,
                                 String comments)
        Create a new RepeatingSchedule that runs a given number of times.
        Parameters:
        startDate - The time at which the schedule starts running. This is not necessarily the time of the first event, but no events will happen before this. May be null, meaning start any time.
        repeats - how many events should happen totally.
        frequency - How frequently the event should happen.
        name - The unique name of the schedule.
        comments - Comments entered by the user
        Throws:
        ArgumentNotValid - if frequency, name or comments is null, or name is "" or repeats is 0 or negative
    • Method Detail

      • equals

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

        public int hashCode()
        Autogenerated hashcode method.
        Overrides:
        hashCode in class Schedule
        Returns:
        the hashcode
      • getNextEvent

        public Date getNextEvent​(Date lastEvent,
                                 int numPreviousEvents)
        Return the date at which the next event will happen.
        Specified by:
        getNextEvent in class Schedule
        Parameters:
        lastEvent - The time at which the previous event happened.
        numPreviousEvents - How many events have previously happened.
        Returns:
        The date of the next event to happen or null for no more events.
        Throws:
        ArgumentNotValid - if numPreviousEvents is negative
      • getRepeats

        public int getRepeats()
        Return how many times this schedule should be triggered.
        Returns:
        That number of times
      • toString

        public String toString()
        Human readable represenation of this object.
        Overrides:
        toString in class Object
        Returns:
        Human readble representation