public abstract static class CronSchedule.Field
extends java.lang.Object
Field
represent the following
5 crontab fields:
Field | minimum | maximum |
---|---|---|
Minute | 0 | 59 |
Hour | 0 | 23 |
Day of the month | 1 | 31 |
Month of the year | 1 | 12 |
Day of the week | 0 | 6 |
Modifier and Type | Method and Description |
---|---|
void |
addScheduleRange(int start,
int end)
Add a range of scheduled values to those values already scheduled.
|
void |
addScheduleValue(int value)
Add a single value to those already scheduled.
|
void |
addScheduleValues(int[] values)
Add several values to be scheduled to those already scheduled.
|
boolean |
allScheduled()
Return
true if all in-range values for this field
are scheduled. |
int |
getMax()
Return the maximum allowable value for field.
|
int |
getMaxScheduled()
Return the maximum in-range value that is scheduled by this
Field instance. |
int |
getMin()
Return the minimum allowable value for field.
|
int |
getMinScheduled()
Return the minimum in-range value that is scheduled by this
Field instance. |
java.util.Iterator |
getScheduledValues()
Return an
Iterator that will iterate over all scheduled
values in this Field instance. |
boolean |
inRange(int checkValue)
Return
true if the passed value falls in the allowable range
for this field. |
abstract boolean |
isScheduled(java.util.Calendar time)
Return
true if that part of date/time represented by the passed Calendar
instance corresponding to this Field is scheduled. |
boolean |
isScheduled(int checkValue)
Return
true if the passed value is in the scheduled specification
for this Field instance. |
void |
parse(java.lang.String spec) |
void |
reset()
Reset this
Field to the equivalent of "*" . |
void |
setScheduleRange(int start,
int end)
Set a range of scheduled values.
|
void |
setScheduleValue(int value)
Set a single value to be scheduled.
|
void |
setScheduleValues(int[] values)
Set several values to be scheduled.
|
java.lang.String |
toString()
Return the
String representation for this Field instance. |
public int getMin()
public int getMax()
public java.lang.String toString()
String
representation for this Field
instance.
Examples:
toString
in class java.lang.Object
String
representationpublic void parse(java.lang.String spec) throws CronSchedule.SpecException
CronSchedule.SpecException
public void reset()
Field
to the equivalent of "*"
.
Note that this means all in-range values are scheduled, not that
no in-range values are scheduled.public void setScheduleRange(int start, int end) throws CronSchedule.SpecException
start
- beginning of rangeend
- end (inclusive) of rangeCronSchedule.SpecException
- thrown if start
or end
are out-of-range.public void addScheduleRange(int start, int end) throws CronSchedule.SpecException
start
- beginning of rangeend
- end (inclusive) of rangeCronSchedule.SpecException
- thrown if start
or end
are out-of-range.public void setScheduleValue(int value) throws CronSchedule.SpecException
value
- the value to be setCronSchedule.SpecException
- thrown if value
is out-of-range.public void addScheduleValue(int value) throws CronSchedule.SpecException
value
- the value to be setCronSchedule.SpecException
- thrown if value
is out-of-range.public void setScheduleValues(int[] values) throws CronSchedule.SpecException
values
- a non-null
array of zero or more valuesCronSchedule.SpecException
- thrown if any element of values
is out-of-range.public void addScheduleValues(int[] values) throws CronSchedule.SpecException
values
- a non-null
array of zero or more valuesCronSchedule.SpecException
- thrown if any element of values
is out-of-range.public boolean allScheduled()
true
if all in-range values for this field
are scheduled. Corresponds to a specification of "*"
(among other possibilities).true
if all in-range values for this field are scheduled.public boolean inRange(int checkValue)
true
if the passed value falls in the allowable range
for this field.checkValue
- value to checktrue
if passed value is in range.public boolean isScheduled(int checkValue)
true
if the passed value is in the scheduled specification
for this Field
instance.
Example: For a day-of-the-week specification of "1-5"
, the passed value
3 will return true
.checkValue
- value to checktrue
if passed value is scheduled by this Field
.public abstract boolean isScheduled(java.util.Calendar time)
true
if that part of date/time represented by the passed Calendar
instance corresponding to this Field
is scheduled.
Example: For a day-of-the-week specification of "1-5"
, the passed value corresponding to
May 30, 2006 10:41 will return true
(since May 30, 2006 is a Tuesday).time
- Calendar
instance to check.true
if passed value is scheduled by this Field
.public int getMinScheduled()
Field
instance.public int getMaxScheduled()
Field
instance.public java.util.Iterator getScheduledValues()
Iterator
that will iterate over all scheduled
values in this Field
instance.Iterator
instance whose next()
method
returns Integer
objects.