|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.harvester.datamodel.Frequency
public abstract class Frequency
This class defines various frequencies at which things can happen, such as midnight every day, 13:45 the first monday of a month, etc.
Constructor Summary | |
---|---|
Frequency(int numUnits,
boolean isAnytime)
Initialise a frequency with information about how many periods between events, and whether it's at a specified time in the period. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Autogenerated equals. |
abstract java.util.Date |
getFirstEvent(java.util.Date startTime)
Given a starting time, tell us when the first event should happen. |
static Frequency |
getNewInstance(int timeunit,
boolean anytime,
int numtimeunits,
java.lang.Integer minute,
java.lang.Integer hour,
java.lang.Integer dayofweek,
java.lang.Integer dayofmonth)
Get a new instance of Frequency. |
abstract java.util.Date |
getNextEvent(java.util.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). |
int |
getNumUnits()
Returns the number of periods between events. |
abstract java.lang.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. |
abstract java.lang.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. |
abstract java.lang.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. |
abstract java.lang.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. |
boolean |
isAnytime()
Returns whether this frequency allows events to happen any time of day, rather than at a specific time. |
abstract int |
ordinal()
Return an integer that can be used to identify the kind of frequency. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Frequency(int numUnits, boolean isAnytime)
numUnits
- Number of periods between eventsisAnytime
- Whether it's at a specified time in the period
ArgumentNotValid
- if numUnits if 0 or negativeMethod Detail |
---|
public abstract java.util.Date getNextEvent(java.util.Date lastEvent)
lastEvent
- A time from which the next event should be calculated.
public abstract java.util.Date getFirstEvent(java.util.Date startTime)
startTime
- The earliest time the event can happen.
public int getNumUnits()
public boolean isAnytime()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to compare with
public int hashCode()
hashCode
in class java.lang.Object
public abstract java.lang.Integer getOnMinute()
public abstract java.lang.Integer getOnHour()
public abstract java.lang.Integer getOnDayOfWeek()
public abstract java.lang.Integer getOnDayOfMonth()
public abstract int ordinal()
public static Frequency getNewInstance(int timeunit, boolean anytime, int numtimeunits, java.lang.Integer minute, java.lang.Integer hour, java.lang.Integer dayofweek, java.lang.Integer dayofmonth)
timeunit
- The type or frequencyanytime
- Allow events to start anytime. If false,
the starting point is described precisely.
If true, the starting point will be immediately.numtimeunits
- The number of periods between eventsminute
- A given minute. Used to create hourly, daily, and monthly frequencies,
if anytime is false.hour
- A given hour. Used to create hourly, daily, and monthly frequencies,
if anytime is false.dayofweek
- A given day of the week. Used only to create weekly frequencies,
if anytime is false.dayofmonth
- A given day of month. Used only to create monthly frequencies,
if anytime is false.
ArgumentNotValid
- If the given timeunit is illegal,
or the values of timeunit and numtimeunits is negative.
NotImplementedException
- If we can't yet make a
Frequency for a legal timeunit.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |