public class DailyCalendar extends BaseCalendar
DailyCalendar
only allows a single time range to be specified, and that time range may not
cross daily boundaries (i.e. you cannot specify a time range from 8PM - 5AM).
If the property invertTimeRange
is false
(default),
the time range defines a range of times in which triggers are not allowed to
fire. If invertTimeRange
is true
, the time range
is inverted – that is, all times outside the defined time range
are excluded.
Note when using DailyCalendar
, it behaves on the same principals
as, for example, WeeklyCalendar
. WeeklyCalendar
defines a set of days that are
excluded every week. Likewise, DailyCalendar
defines a
set of times that are excluded every day.
Constructor and Description |
---|
DailyCalendar(Calendar rangeStartingCalendar,
Calendar rangeEndingCalendar)
Create a
DailyCalendar with a time range defined by the
specified java.util.Calendar s and no
baseCalendar . |
DailyCalendar(Calendar baseCalendar,
Calendar rangeStartingCalendar,
Calendar rangeEndingCalendar)
Create a
DailyCalendar with a time range defined by the
specified java.util.Calendar s and the specified
baseCalendar . |
DailyCalendar(Calendar baseCalendar,
int rangeStartingHourOfDay,
int rangeStartingMinute,
int rangeStartingSecond,
int rangeStartingMillis,
int rangeEndingHourOfDay,
int rangeEndingMinute,
int rangeEndingSecond,
int rangeEndingMillis)
Create a
DailyCalendar with a time range defined by the
specified values and the specified baseCalendar . |
DailyCalendar(Calendar baseCalendar,
long rangeStartingTimeInMillis,
long rangeEndingTimeInMillis)
Create a
DailyCalendar with a time range defined by the
specified values and the specified baseCalendar . |
DailyCalendar(Calendar baseCalendar,
String rangeStartingTime,
String rangeEndingTime)
Create a
DailyCalendar with a time range defined by the
specified strings and the specified baseCalendar . |
DailyCalendar(Calendar baseCalendar,
TimeZone timeZone,
long rangeStartingTimeInMillis,
long rangeEndingTimeInMillis)
Create a
DailyCalendar with a time range defined by the
specified values and the specified baseCalendar . |
DailyCalendar(int rangeStartingHourOfDay,
int rangeStartingMinute,
int rangeStartingSecond,
int rangeStartingMillis,
int rangeEndingHourOfDay,
int rangeEndingMinute,
int rangeEndingSecond,
int rangeEndingMillis)
Create a
DailyCalendar with a time range defined by the
specified values and no baseCalendar . |
DailyCalendar(long rangeStartingTimeInMillis,
long rangeEndingTimeInMillis)
Create a
DailyCalendar with a time range defined by the
specified values and no baseCalendar . |
DailyCalendar(String rangeStartingTime,
String rangeEndingTime)
Create a
DailyCalendar with a time range defined by the
specified strings and no baseCalendar . |
DailyCalendar(TimeZone timeZone,
long rangeStartingTimeInMillis,
long rangeEndingTimeInMillis)
Create a
DailyCalendar with a time range defined by the
specified values and no baseCalendar . |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
boolean |
getInvertTimeRange()
Indicates whether the time range represents an inverted time range (see
class description).
|
long |
getNextIncludedTime(long timeInMillis)
Determines the next time included by the
DailyCalendar
after the specified time. |
long |
getTimeRangeEndingTimeInMillis(long timeInMillis)
Returns the end time of the time range (in milliseconds) of the day
specified in
timeInMillis |
long |
getTimeRangeStartingTimeInMillis(long timeInMillis)
Returns the start time of the time range (in milliseconds) of the day
specified in
timeInMillis |
boolean |
isTimeIncluded(long timeInMillis)
Determines whether the given time (in milliseconds) is 'included' by the
BaseCalendar |
void |
setInvertTimeRange(boolean flag)
Indicates whether the time range represents an inverted time range (see
class description).
|
void |
setTimeRange(Calendar rangeStartingCalendar,
Calendar rangeEndingCalendar)
Sets the time range for the
DailyCalendar to the times
represented in the specified java.util.Calendar s. |
void |
setTimeRange(int rangeStartingHourOfDay,
int rangeStartingMinute,
int rangeStartingSecond,
int rangeStartingMillis,
int rangeEndingHourOfDay,
int rangeEndingMinute,
int rangeEndingSecond,
int rangeEndingMillis)
Sets the time range for the
DailyCalendar to the times
represented in the specified values. |
void |
setTimeRange(long rangeStartingTime,
long rangeEndingTime)
Sets the time range for the
DailyCalendar to the times
represented in the specified values. |
void |
setTimeRange(String rangeStartingTimeString,
String rangeEndingTimeString)
Sets the time range for the
DailyCalendar to the times
represented in the specified Strings. |
String |
toString()
Returns a string representing the properties of the
DailyCalendar |
createJavaCalendar, createJavaCalendar, getBaseCalendar, getDescription, getEndOfDayJavaCalendar, getStartOfDayJavaCalendar, getTimeZone, setBaseCalendar, setDescription, setTimeZone
public DailyCalendar(String rangeStartingTime, String rangeEndingTime)
DailyCalendar
with a time range defined by the
specified strings and no baseCalendar
.
rangeStartingTime
and rangeEndingTime
must be in the format "HH:MM[:SS[:mmm]]" where:
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
BaseCalendar.setTimeZone(TimeZone)
rangeStartingTime
- a String representing the starting time for the
time rangerangeEndingTime
- a String representing the ending time for the
the time rangepublic DailyCalendar(Calendar baseCalendar, String rangeStartingTime, String rangeEndingTime)
DailyCalendar
with a time range defined by the
specified strings and the specified baseCalendar
.
rangeStartingTime
and rangeEndingTime
must be in the format "HH:MM[:SS[:mmm]]" where:
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
BaseCalendar.setTimeZone(TimeZone)
baseCalendar
- the base calendar for this calendar instance
– see BaseCalendar
for more
information on base calendar functionalityrangeStartingTime
- a String representing the starting time for the
time rangerangeEndingTime
- a String representing the ending time for the
time rangepublic DailyCalendar(int rangeStartingHourOfDay, int rangeStartingMinute, int rangeStartingSecond, int rangeStartingMillis, int rangeEndingHourOfDay, int rangeEndingMinute, int rangeEndingSecond, int rangeEndingMillis)
DailyCalendar
with a time range defined by the
specified values and no baseCalendar
. Values are subject to
the following validations:
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
BaseCalendar.setTimeZone(TimeZone)
rangeStartingHourOfDay
- the hour of the start of the time rangerangeStartingMinute
- the minute of the start of the time rangerangeStartingSecond
- the second of the start of the time rangerangeStartingMillis
- the millisecond of the start of the time
rangerangeEndingHourOfDay
- the hour of the end of the time rangerangeEndingMinute
- the minute of the end of the time rangerangeEndingSecond
- the second of the end of the time rangerangeEndingMillis
- the millisecond of the start of the time
rangepublic DailyCalendar(Calendar baseCalendar, int rangeStartingHourOfDay, int rangeStartingMinute, int rangeStartingSecond, int rangeStartingMillis, int rangeEndingHourOfDay, int rangeEndingMinute, int rangeEndingSecond, int rangeEndingMillis)
DailyCalendar
with a time range defined by the
specified values and the specified baseCalendar
. Values are
subject to the following validations:
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
BaseCalendar.setTimeZone(TimeZone)
baseCalendar
- the base calendar for this calendar
instance – see
BaseCalendar
for more
information on base calendar
functionalityrangeStartingHourOfDay
- the hour of the start of the time rangerangeStartingMinute
- the minute of the start of the time rangerangeStartingSecond
- the second of the start of the time rangerangeStartingMillis
- the millisecond of the start of the time
rangerangeEndingHourOfDay
- the hour of the end of the time rangerangeEndingMinute
- the minute of the end of the time rangerangeEndingSecond
- the second of the end of the time rangerangeEndingMillis
- the millisecond of the start of the time
rangepublic DailyCalendar(Calendar rangeStartingCalendar, Calendar rangeEndingCalendar)
DailyCalendar
with a time range defined by the
specified java.util.Calendar
s and no
baseCalendar
. The Calendars are subject to the following
considerations:
rangeStartingCalendar.after(rangeEndingCalendar) ==
true
)
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
BaseCalendar.setTimeZone(TimeZone)
rangeStartingCalendar
- a java.util.Calendar representing the
starting time for the time rangerangeEndingCalendar
- a java.util.Calendar representing the ending
time for the time rangepublic DailyCalendar(Calendar baseCalendar, Calendar rangeStartingCalendar, Calendar rangeEndingCalendar)
DailyCalendar
with a time range defined by the
specified java.util.Calendar
s and the specified
baseCalendar
. The Calendars are subject to the following
considerations:
rangeStartingCalendar.after(rangeEndingCalendar) ==
true
)
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
BaseCalendar.setTimeZone(TimeZone)
baseCalendar
- the base calendar for this calendar instance
– see BaseCalendar
for more
information on base calendar functionalityrangeStartingCalendar
- a java.util.Calendar representing the
starting time for the time rangerangeEndingCalendar
- a java.util.Calendar representing the ending
time for the time rangepublic DailyCalendar(long rangeStartingTimeInMillis, long rangeEndingTimeInMillis)
DailyCalendar
with a time range defined by the
specified values and no baseCalendar
. The values are
subject to the following considerations:
rangeStartingTime >
rangeEndingTime
)
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
.
You should use BaseCalendar.setTimeZone(TimeZone)
if you don't want the given DailyCalendar(org.quartz.Calendar, java.util.TimeZone, long, long)
rangeStartingTimeInMillis
and
rangeEndingTimeInMillis
to be evaluated in the default
time zone.
rangeStartingTimeInMillis
- a long representing the starting time
for the time rangerangeEndingTimeInMillis
- a long representing the ending time for
the time rangepublic DailyCalendar(Calendar baseCalendar, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis)
DailyCalendar
with a time range defined by the
specified values and the specified baseCalendar
. The values
are subject to the following considerations:
rangeStartingTime >
rangeEndingTime
)
Note: This DailyCalendar
will use the
time zone unless an explicit
time zone is set via TimeZone.getDefault()
.
You should use BaseCalendar.setTimeZone(TimeZone)
if you don't want the given DailyCalendar(org.quartz.Calendar, java.util.TimeZone, long, long)
rangeStartingTimeInMillis
and
rangeEndingTimeInMillis
to be evaluated in the default
time zone.
baseCalendar
- the base calendar for this calendar
instance – see BaseCalendar
for more information on
base calendar functionalityrangeStartingTimeInMillis
- a long representing the starting time
for the time rangerangeEndingTimeInMillis
- a long representing the ending time for
the time rangepublic DailyCalendar(TimeZone timeZone, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis)
DailyCalendar
with a time range defined by the
specified values and no baseCalendar
. The values are
subject to the following considerations:
rangeStartingTime >
rangeEndingTime
)timeZone
- the time zone for of the
DailyCalendar
which will
also be used to resolve the given
start/end times.rangeStartingTimeInMillis
- a long representing the starting time
for the time rangerangeEndingTimeInMillis
- a long representing the ending time for
the time rangepublic DailyCalendar(Calendar baseCalendar, TimeZone timeZone, long rangeStartingTimeInMillis, long rangeEndingTimeInMillis)
DailyCalendar
with a time range defined by the
specified values and the specified baseCalendar
. The values
are subject to the following considerations:
rangeStartingTime >
rangeEndingTime
)baseCalendar
- the base calendar for this calendar
instance – see BaseCalendar
for more information on
base calendar functionalitytimeZone
- the time zone for of the
DailyCalendar
which will
also be used to resolve the given
start/end times.rangeStartingTimeInMillis
- a long representing the starting time
for the time rangerangeEndingTimeInMillis
- a long representing the ending time for
the time rangepublic Object clone()
clone
in interface Calendar
clone
in class BaseCalendar
public boolean isTimeIncluded(long timeInMillis)
BaseCalendar
isTimeIncluded
in interface Calendar
isTimeIncluded
in class BaseCalendar
timeInMillis
- the date/time to testBaseCalendar
Calendar.isTimeIncluded(long)
public long getNextIncludedTime(long timeInMillis)
DailyCalendar
after the specified time.getNextIncludedTime
in interface Calendar
getNextIncludedTime
in class BaseCalendar
timeInMillis
- the initial date/time after which to find an
included timeCalendar.getNextIncludedTime(long)
public long getTimeRangeStartingTimeInMillis(long timeInMillis)
timeInMillis
timeInMillis
- a time containing the desired date for the starting
time of the time range.public long getTimeRangeEndingTimeInMillis(long timeInMillis)
timeInMillis
timeInMillis
- a time containing the desired date for the ending
time of the time range.public boolean getInvertTimeRange()
public void setInvertTimeRange(boolean flag)
flag
- the new value for the invertTimeRange
flag.public String toString()
DailyCalendar
public void setTimeRange(String rangeStartingTimeString, String rangeEndingTimeString)
DailyCalendar
to the times
represented in the specified Strings.rangeStartingTimeString
- a String representing the start time of
the time rangerangeEndingTimeString
- a String representing the end time of the
excluded time rangepublic void setTimeRange(int rangeStartingHourOfDay, int rangeStartingMinute, int rangeStartingSecond, int rangeStartingMillis, int rangeEndingHourOfDay, int rangeEndingMinute, int rangeEndingSecond, int rangeEndingMillis)
DailyCalendar
to the times
represented in the specified values.rangeStartingHourOfDay
- the hour of the start of the time rangerangeStartingMinute
- the minute of the start of the time rangerangeStartingSecond
- the second of the start of the time rangerangeStartingMillis
- the millisecond of the start of the time
rangerangeEndingHourOfDay
- the hour of the end of the time rangerangeEndingMinute
- the minute of the end of the time rangerangeEndingSecond
- the second of the end of the time rangerangeEndingMillis
- the millisecond of the start of the time
rangepublic void setTimeRange(Calendar rangeStartingCalendar, Calendar rangeEndingCalendar)
DailyCalendar
to the times
represented in the specified java.util.Calendar
s.rangeStartingCalendar
- a Calendar containing the start time for
the DailyCalendar
rangeEndingCalendar
- a Calendar containing the end time for
the DailyCalendar
public void setTimeRange(long rangeStartingTime, long rangeEndingTime)
DailyCalendar
to the times
represented in the specified values.rangeStartingTime
- the starting time (in milliseconds) for the
time rangerangeEndingTime
- the ending time (in milliseconds) for the time
rangeCopyright 2001-2019, Terracotta, Inc.