public class DailyFrequency extends Frequency
Constructor and Description |
---|
DailyFrequency(int numUnits)
Create a new daily frequency that happens every numUnits days, anytime.
|
DailyFrequency(int numUnits,
int hour,
int minute)
Create a new daily frequency that happens every numUnits days, on the given hour and minute.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Autogenerated equals.
|
Date |
getFirstEvent(Date startTime)
Given a starting time, tell us when the first event should happen.
|
int |
getHour()
If not anytime, the hour at which events should start.
|
int |
getMinute()
If not anytime, the minute at which events should start.
|
Date |
getNextEvent(Date lastEvent)
Given when the last event happened, tell us when the next event should happen (even if the new event is in the
past).
|
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.
|
String |
toString()
Human readable representation of this object.
|
getNewInstance, getNumUnits, isAnytime
public DailyFrequency(int numUnits)
numUnits
- Number of days from event to event.ArgumentNotValid
- if numUnits if 0 or negativepublic DailyFrequency(int numUnits, int hour, int minute)
numUnits
- Number of days from event to event.hour
- The hour on which the event should happen.minute
- The minute of hour on which the event should happen.ArgumentNotValid
- if numUnits if 0 or negative or hours is <0 or >23 or minutes is <0 or >59public Date getNextEvent(Date lastEvent)
The time of the next event is guaranteed to be later that lastEvent. For certain frequencies (e.g. once a day, any time of day), the time of the next event is derived from lastEvent, for others (e.g. once a day at 13:00) the time of the next event is the first matching time after lastEvent.
getNextEvent
in class Frequency
lastEvent
- A time from which the next event should be calculated.public Date getFirstEvent(Date startTime)
getFirstEvent
in class Frequency
startTime
- The earliest time the event can happen.public int getMinute()
public int getHour()
public int hashCode()
public Integer getOnMinute()
getOnMinute
in class Frequency
public Integer getOnHour()
public Integer getOnDayOfWeek()
getOnDayOfWeek
in class Frequency
public Integer getOnDayOfMonth()
getOnDayOfMonth
in class Frequency
public int ordinal()
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.