'' specifies skips of the number's value through the range. For
example, ``0-23/2'' can be used in the hours field to specify command
execution every other hour (the alternative in the V7 standard is
``0,2,4,6,8,10,12,14,16,18,20,22''). Steps are also permitted after an
asterisk, so if you want to say ``every two hours'', just use ``*\/2''.
Names can also be used for the ``month'' and ``day of week'' fields. Use the
first three letters of the particular day or month (case doesn't matter).
Ranges or lists of names are allowed.
The ``sixth'' field (the rest of the line) specifies the command to be run.
The entire command portion of the line, up to a newline or % character, will
be executed. Percent-signs (%) in the command, unless escaped with backslash
(\\), will be changed into newline characters, and all data after the first
% will be sent to the command as standard input. (Actually not true about %
signs. Needs implementing).
Note: The day of a command's execution can be specified by two fields day of
month, and day of week. If both fields are restricted (ie, aren't *), the
command will be run when either field matches the current time. For example,
``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and
15th of each month, plus every Friday.
EXAMPLE CRON FILE
# run five minutes after midnight, every day
5 0 * * * com.foo.Task1
# run at 2:15pm on the first of every month
15 14 1 * * com.foo.Task1
# run at 10 pm on weekdays
0 22 * * 1-5 com.foo.Task1
# run 23 minutes after midn, 2am, 4am ..., everyday
23 0-23/2 * * * com.foo.Task1
# run at 5 after 4 every sunday"
5 4 * * sun com.foo.Task1
EXTENSIONS
When specifying day of week, both day 0 and day 7 will be considered Sunday.
(Needs implementing). BSD and ATT seem to disagree about this. Lists and
ranges are allowed to co-exist in the same field. "1-3,7-9" would be
rejected by ATT or BSD cron -- they want to see "1-3" or "7,8,9" ONLY.
Ranges can include "steps", so "1-9/2" is the same as "1,3,5,7,9". Names of
months or days of the week can be specified by name.
BUGS
I think the following bugs are now fixed, but I leave these reports here for
the moment...
I received the following bug report. What it boils down to is if you specify
anything other than "*" for a week day but you don't specify a date then
there is a problem. At least that is what I think it boils down to. It needs
fixing but I havn't had time. Anyway here is the bug report...If I specify 0
1 * FEB SUN that should be executed only at 1h00 all the Sundays of
February, the 10 first dates I get are wrong (start not the 3 February 2002,
have some Saturday and some monday) see 1.bmp file. If I specify 0 1 31 * *
that should be executed only at 1h00 all the 31 of each month, the 10 first
dates I get are also wrong (the date that does not exist like the 31
February or the 31 june are returned in the next month, for example: 31
February is executed the 3 march)
THIS is another bug report which may have been fixed but now I can't
remember: But the bad new is that it does not work for the following
entry: 0 1 29 FEB * (all the 29 february at 1h00 am) [the enternal problem of
the leap-year !]. It enter in a infinite loop I think. The following
entry work without problem: 0 0 28,29 JAN *.
- See Also:
- Serialized Form
Method Summary |
(package private) java.lang.String |
ab2s(boolean[] array)
Helper class for toString(). |
(package private) java.lang.String |
as2s(java.lang.String[] array)
Helper class for toString(). |
(package private) static int |
calcThisYear()
Return this year as an integer. |
(package private) boolean |
conformsTo(boolean[] set,
int tm)
|
(package private) boolean |
dateConformsTo(java.util.Calendar date)
|
void |
execute()
Start a thread to execute the class. |
(package private) int |
findNext(int tm,
boolean[] array,
CrontabEntry.ParseSpec spec,
java.util.Calendar cal)
Find the next occurance of an event within this array. |
java.lang.String[] |
getArgs()
|
boolean[] |
getArray(CrontabEntry.ParseSpec spec)
Get one of the fields as a boolean array. |
java.lang.String |
getClassName()
|
boolean[] |
getDatesArray()
Get the dates value as an array |
java.lang.String |
getDatesString()
Get the dates value as a String |
boolean[] |
getDaysArray()
Get the days of week value as an array |
java.lang.String |
getDaysString()
Get the days of week value as a String |
boolean[] |
getHoursArray()
Get the hours value as an array |
java.lang.String |
getHoursString()
Get the hours value as a String |
boolean[] |
getMilliSecondsArray()
Get the milliSeconds value as an array |
java.lang.String |
getMilliSecondsString()
Get the milliSeconds value as a String |
boolean[] |
getMinutesArray()
Get the minutes value as an array |
java.lang.String |
getMinutesString()
Get the minutes value as a String |
boolean[] |
getMonthsArray()
Get the months value as an array |
java.lang.String |
getMonthsString()
Get the months value as a String |
boolean[] |
getSecondsArray()
Get the seconds value as an array |
java.lang.String |
getSecondsString()
Get the seconds value as an String |
java.lang.String |
getString(CrontabEntry.ParseSpec spec)
Get one of the fields as a String. |
boolean[] |
getYearsArray()
Get the years value as an array |
java.lang.String |
getYearsString()
Get the years value as a String |
(package private) static boolean[] |
hackArray(boolean[] array,
CrontabEntry.ParseSpec spec)
|
(package private) static boolean[] |
hackArray(boolean[] array,
int arraySize)
A couple of special cases greatly reduce our memory usage, and more
importantly our processing time. |
(package private) static boolean |
isSet(int n,
boolean[] array,
CrontabEntry.ParseSpec spec)
|
boolean |
isSetDate(int n)
Is date n scheduled for execution? |
boolean |
isSetDay(int n)
Is day of week n scheduled for execution? |
boolean |
isSetHours(int n)
Is hour n scheduled for execution? |
boolean |
isSetMilliSeconds(int n)
Is milliSecond n scheduled for execution? |
boolean |
isSetMinutes(int n)
Is minute n scheduled for execution? |
boolean |
isSetMonth(int n)
Is month n scheduled for execution? |
boolean |
isSetSeconds(int n)
Is second n scheduled for execution? |
boolean |
isSetYear(int n)
Is year n scheduled for execution? |
(package private) boolean |
latterConforms(java.util.Calendar cal,
CrontabEntry.ParseSpec spec)
|
(package private) static java.lang.String |
makeOne(int num,
CrontabEntry.ParseSpec spec)
|
static java.lang.String |
makeString(boolean[] array,
CrontabEntry.ParseSpec spec)
Convert a boolean array into the corresponding Unix spec String. |
(package private) static java.lang.String |
makeToken(int num,
int first,
int last,
int step,
CrontabEntry.ParseSpec spec)
|
long |
nextEvent(long fromTime)
When is the next event that occurs at or after fromTime? Note the tricky
code caused by the arrays being zero based but Calendar using a 1-based
system for DAY_OF_MONTH. |
void |
parse(java.lang.String str,
CrontabEntry.ParseSpec[] style)
Parses a string describing this crontab entry |
(package private) static void |
parseRange(java.lang.String token,
boolean[] array,
int arrayBase,
java.lang.String[] names)
Parse a range which is one component of a list of comma separated values. |
static boolean[] |
parseToken(java.lang.String token,
CrontabEntry.ParseSpec spec)
|
(package private) static boolean[] |
parseToken(java.lang.String token,
int arraySize,
int arrayBase,
java.lang.String[] names)
Parse one component of the entry according to the Unix spec. |
static boolean[] |
parseTokenHack(java.lang.String token,
CrontabEntry.ParseSpec spec)
|
(package private) static boolean[] |
parseTokenHack(java.lang.String token,
int arraySize,
int arrayBase,
java.lang.String[] names)
Parse the token and do the special hackArray transformations. |
void |
set(boolean[] array,
CrontabEntry.ParseSpec spec)
Set one of the fields given a boolean array. |
void |
set(java.lang.String v,
CrontabEntry.ParseSpec spec)
Set one of the fields given a String. |
void |
setArgs(java.lang.String[] v)
|
void |
setClassName(java.lang.String v)
|
void |
setDates(boolean[] array)
Set the dates of the month field given an array |
void |
setDates(java.lang.String v)
Set the dates of the month field given a String |
void |
setDays(boolean[] array)
Set the days of week field given an array |
void |
setDays(java.lang.String v)
Set the days of week field given a String |
void |
setHours(boolean[] array)
Set the hours field given an array |
void |
setHours(java.lang.String v)
Set the hours field given a String |
void |
setMilliSeconds(boolean[] array)
Set the milliSeconds field given a boolean array |
void |
setMilliSeconds(java.lang.String v)
Set the milliSeconds field given a String |
void |
setMinutes(boolean[] array)
Set the minutes field given an array |
void |
setMinutes(java.lang.String v)
Set the minutes field given an array |
void |
setMonths(boolean[] array)
Set the months field given an array |
void |
setMonths(java.lang.String v)
Set the months field given a String |
void |
setSeconds(boolean[] array)
Set the seconds field given an array |
void |
setSeconds(java.lang.String v)
Set the seconds field given a String |
void |
setYears(boolean[] array)
Set the years field given an array |
void |
setYears(java.lang.String v)
Set the years field given a String |
(package private) static int |
tokToIndex(java.lang.String[] names,
java.lang.String tok,
int arrayBase)
|
java.lang.String |
toString()
|
(package private) static boolean[] |
unhackArray(boolean[] array,
CrontabEntry.ParseSpec spec)
|
(package private) static boolean[] |
unhackArray(boolean[] array,
int arraySize)
This does the opposite of hackArray. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
dayNames
public static final java.lang.String[] dayNames
monthNames
public static final java.lang.String[] monthNames
dayAbbrev
public static final java.lang.String[] dayAbbrev
monthAbbrev
public static final java.lang.String[] monthAbbrev
MILLIS_IN_SECOND
public static final int MILLIS_IN_SECOND
- See Also:
- Constant Field Values
SECONDS_IN_MINUTE
public static final int SECONDS_IN_MINUTE
- See Also:
- Constant Field Values
MINUTES_IN_HOUR
public static final int MINUTES_IN_HOUR
- See Also:
- Constant Field Values
HOURS_IN_DAY
public static final int HOURS_IN_DAY
- See Also:
- Constant Field Values
DAYS_IN_MONTH
public static final int DAYS_IN_MONTH
- See Also:
- Constant Field Values
DAYS_IN_WEEK
public static final int DAYS_IN_WEEK
- See Also:
- Constant Field Values
MONTHS_IN_YEAR
public static final int MONTHS_IN_YEAR
- See Also:
- Constant Field Values
YEARS_IN_SPACE_TIME
public static final int YEARS_IN_SPACE_TIME
- See Also:
- Constant Field Values
ARRAY_ONE_BASED
static final int ARRAY_ONE_BASED
- This a constant used to signify which fields are one based. e.g. Dates
- See Also:
- Constant Field Values
ARRAY_ZERO_BASED
static final int ARRAY_ZERO_BASED
- This a constant used to signify which fields are zero based. e.g. Hours and
Minutes
- See Also:
- Constant Field Values
INVALID
static final int INVALID
- See Also:
- Constant Field Values
yearArrayBase
public static final int yearArrayBase
- Our boolean array of years has to start at a particular year. Rather than
hard code a certain year, we use this year as a base. (We can't schedule
things in the past right?). Potential problem here is that if we serialize
a CrontabEntry across a socket near the end of the year, the other end may
use a different base. I guess this needs fixing.
milliSecondSpec
public static final CrontabEntry.ParseSpec milliSecondSpec
secondSpec
public static final CrontabEntry.ParseSpec secondSpec
minuteSpec
public static final CrontabEntry.ParseSpec minuteSpec
hourSpec
public static final CrontabEntry.ParseSpec hourSpec
dateSpec
public static final CrontabEntry.ParseSpec dateSpec
monthSpec
public static final CrontabEntry.ParseSpec monthSpec
daySpec
public static final CrontabEntry.ParseSpec daySpec
yearSpec
public static final CrontabEntry.ParseSpec yearSpec
UNIX_STYLE
public static final CrontabEntry.ParseSpec[] UNIX_STYLE
- Several styles of Crontab supported. Traditional Unix style which is
MIN HOUR DATE MONTH DAY command
Unix and years...
MIN HOUR DATE MONTH YEAR DAY command
and extended style which is
MILLISECOND SECOND MIN HOUR DATE MONTH YEAR DAY command
UNIX_STYLE_AND_YEARS
public static final CrontabEntry.ParseSpec[] UNIX_STYLE_AND_YEARS
EXTENDED_STYLE
public static final CrontabEntry.ParseSpec[] EXTENDED_STYLE
className
java.lang.String className
args
java.lang.String[] args
threadGroup
java.lang.ThreadGroup threadGroup
milliSecondSet
boolean[] milliSecondSet
- When using UNIX_STYLE, milliSeconds and seconds will default to "0", but
years will default to "*". (null is "*").
secondSet
boolean[] secondSet
minuteSet
boolean[] minuteSet
hourSet
boolean[] hourSet
dateSet
boolean[] dateSet
monthSet
boolean[] monthSet
yearSet
boolean[] yearSet
daySet
boolean[] daySet
rotate
int rotate
from
java.util.Calendar from
calDate
java.util.Calendar calDate
calDay
java.util.Calendar calDay
CrontabEntry
public CrontabEntry(java.lang.ThreadGroup threadGroup,
java.lang.String line,
CrontabEntry.ParseSpec[] style)
throws CrontabParseException,
CrontabEmptyException
CrontabEntry
public CrontabEntry(java.lang.ThreadGroup threadGroup)
CrontabEntry
public CrontabEntry()
makeString
public static java.lang.String makeString(boolean[] array,
CrontabEntry.ParseSpec spec)
- Convert a boolean array into the corresponding Unix spec String. This
function can handled "hacked" arrays.
- Parameters:
array
- Description of Parameterspec
- Description of Parameter
- Returns:
- Description of the Returned Value
parseToken
public static boolean[] parseToken(java.lang.String token,
CrontabEntry.ParseSpec spec)
throws CrontabParseException
CrontabParseException
parseTokenHack
public static boolean[] parseTokenHack(java.lang.String token,
CrontabEntry.ParseSpec spec)
throws CrontabParseException,
CrontabEmptyException
CrontabParseException
CrontabEmptyException
isSet
static boolean isSet(int n,
boolean[] array,
CrontabEntry.ParseSpec spec)
calcThisYear
static int calcThisYear()
- Return this year as an integer.
- Returns:
- Description of the Returned Value
makeOne
static java.lang.String makeOne(int num,
CrontabEntry.ParseSpec spec)
makeToken
static java.lang.String makeToken(int num,
int first,
int last,
int step,
CrontabEntry.ParseSpec spec)
hackArray
static boolean[] hackArray(boolean[] array,
CrontabEntry.ParseSpec spec)
throws CrontabEmptyException
CrontabEmptyException
unhackArray
static boolean[] unhackArray(boolean[] array,
CrontabEntry.ParseSpec spec)
parseToken
static boolean[] parseToken(java.lang.String token,
int arraySize,
int arrayBase,
java.lang.String[] names)
throws CrontabParseException
- Parse one component of the entry according to the Unix spec.
- Parameters:
token
- a string of the form "range,range,..."arrayBase
- if 1 is the first valid value, pass "1",
else pass 0.arraySize
- Description of Parameternames
- Description of Parameter
- Returns:
- Description of the Returned Value
- Throws:
CrontabParseException
- Description of Exception
parseTokenHack
static boolean[] parseTokenHack(java.lang.String token,
int arraySize,
int arrayBase,
java.lang.String[] names)
throws CrontabParseException,
CrontabEmptyException
- Parse the token and do the special hackArray transformations.
- Parameters:
token
- Description of ParameterarraySize
- Description of ParameterarrayBase
- Description of Parameternames
- Description of Parameter
- Returns:
- Description of the Returned Value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
unhackArray
static boolean[] unhackArray(boolean[] array,
int arraySize)
- This does the opposite of hackArray. i.e. it converts a possibly null
reference or possibly shortened array into the full array. This is useful
for passing the array back to the user of the class who doesn't want to
know about these internal special cases.
- Parameters:
array
- Description of ParameterarraySize
- Description of Parameter
- Returns:
- Description of the Returned Value
hackArray
static boolean[] hackArray(boolean[] array,
int arraySize)
throws CrontabEmptyException
- A couple of special cases greatly reduce our memory usage, and more
importantly our processing time. Firstly, a null array is a shorthand for
"*". Secondly, the array is shortened and any "missing" entries are assumed
to be false. This is most useful for "0" only values. The Day/Date code
relies on the "null array" special case being used.
- Parameters:
array
- Description of ParameterarraySize
- Description of Parameter
- Returns:
- Description of the Returned Value
- Throws:
CrontabEmptyException
- Description of Exception
tokToIndex
static int tokToIndex(java.lang.String[] names,
java.lang.String tok,
int arrayBase)
throws CrontabParseException
- Parameters:
arrayBase
- if Calendar starts counting at one, pass
"1", else pass "0"names
- Description of Parametertok
- Description of Parameter
- Returns:
- Description of the Returned Value
- Throws:
CrontabParseException
- Description of Exception
parseRange
static void parseRange(java.lang.String token,
boolean[] array,
int arrayBase,
java.lang.String[] names)
throws CrontabParseException
- Parse a range which is one component of a list of comma separated values.
- Parameters:
token
- a string of the form "from-to/step".arrayBase
- if Calendar starts counting at one, pass
"1", else pass "0"array
- Description of Parameternames
- Description of Parameter
- Throws:
CrontabParseException
- Description of Exception
set
public void set(java.lang.String v,
CrontabEntry.ParseSpec spec)
throws CrontabParseException,
CrontabEmptyException
- Set one of the fields given a String. Which field is set is determined by
the particular ParseSpec object passed in.
- Parameters:
v
- Description of Parameterspec
- Description of Parameter
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
set
public void set(boolean[] array,
CrontabEntry.ParseSpec spec)
throws CrontabEmptyException
- Set one of the fields given a boolean array. Which field is set is
determined by the particular ParseSpec object passed in.
- Parameters:
array
- Description of Parameterspec
- Description of Parameter
- Throws:
CrontabEmptyException
- Description of Exception
setMilliSeconds
public void setMilliSeconds(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the milliSeconds field given a String
- Parameters:
v
- The new milliSeconds value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setMilliSeconds
public void setMilliSeconds(boolean[] array)
throws CrontabEmptyException
- Set the milliSeconds field given a boolean array
- Parameters:
array
- The new milliSeconds value
- Throws:
CrontabEmptyException
- Description of Exception
setSeconds
public void setSeconds(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the seconds field given a String
- Parameters:
v
- The new seconds value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setSeconds
public void setSeconds(boolean[] array)
throws CrontabEmptyException
- Set the seconds field given an array
- Parameters:
array
- The new seconds value
- Throws:
CrontabEmptyException
- Description of Exception
setMinutes
public void setMinutes(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the minutes field given an array
- Parameters:
v
- The new minutes value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setMinutes
public void setMinutes(boolean[] array)
throws CrontabEmptyException
- Set the minutes field given an array
- Parameters:
array
- The new minutes value
- Throws:
CrontabEmptyException
- Description of Exception
setHours
public void setHours(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the hours field given a String
- Parameters:
v
- The new hours value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setHours
public void setHours(boolean[] array)
throws CrontabEmptyException
- Set the hours field given an array
- Parameters:
array
- The new hours value
- Throws:
CrontabEmptyException
- Description of Exception
setDates
public void setDates(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the dates of the month field given a String
- Parameters:
v
- The new dates value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setDates
public void setDates(boolean[] array)
throws CrontabEmptyException
- Set the dates of the month field given an array
- Parameters:
array
- The new dates value
- Throws:
CrontabEmptyException
- Description of Exception
setMonths
public void setMonths(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the months field given a String
- Parameters:
v
- The new months value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setMonths
public void setMonths(boolean[] array)
throws CrontabEmptyException
- Set the months field given an array
- Parameters:
array
- The new months value
- Throws:
CrontabEmptyException
- Description of Exception
setYears
public void setYears(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the years field given a String
- Parameters:
v
- The new years value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setYears
public void setYears(boolean[] array)
throws CrontabEmptyException
- Set the years field given an array
- Parameters:
array
- The new years value
- Throws:
CrontabEmptyException
- Description of Exception
setDays
public void setDays(java.lang.String v)
throws CrontabParseException,
CrontabEmptyException
- Set the days of week field given a String
- Parameters:
v
- The new days value
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
setDays
public void setDays(boolean[] array)
throws CrontabEmptyException
- Set the days of week field given an array
- Parameters:
array
- The new days value
- Throws:
CrontabEmptyException
- Description of Exception
setClassName
public void setClassName(java.lang.String v)
setArgs
public void setArgs(java.lang.String[] v)
getString
public java.lang.String getString(CrontabEntry.ParseSpec spec)
- Get one of the fields as a String. Which field is got is determined by the
particular ParseSpec object passed in.
- Parameters:
spec
- Description of Parameter
- Returns:
- The string value
getArray
public boolean[] getArray(CrontabEntry.ParseSpec spec)
- Get one of the fields as a boolean array. Which field is got is determined
by the particular ParseSpec object passed in.
- Parameters:
spec
- Description of Parameter
- Returns:
- The array value
isSetMilliSeconds
public boolean isSetMilliSeconds(int n)
- Is milliSecond n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setMilliSeconds value
getMilliSecondsString
public java.lang.String getMilliSecondsString()
- Get the milliSeconds value as a String
- Returns:
- The milliSecondsString value
getMilliSecondsArray
public boolean[] getMilliSecondsArray()
- Get the milliSeconds value as an array
- Returns:
- The milliSecondsArray value
isSetSeconds
public boolean isSetSeconds(int n)
- Is second n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setSeconds value
getSecondsString
public java.lang.String getSecondsString()
- Get the seconds value as an String
- Returns:
- The secondsString value
getSecondsArray
public boolean[] getSecondsArray()
- Get the seconds value as an array
- Returns:
- The secondsArray value
isSetMinutes
public boolean isSetMinutes(int n)
- Is minute n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setMinutes value
getMinutesString
public java.lang.String getMinutesString()
- Get the minutes value as a String
- Returns:
- The minutesString value
getMinutesArray
public boolean[] getMinutesArray()
- Get the minutes value as an array
- Returns:
- The minutesArray value
isSetHours
public boolean isSetHours(int n)
- Is hour n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setHours value
getHoursString
public java.lang.String getHoursString()
- Get the hours value as a String
- Returns:
- The hoursString value
getHoursArray
public boolean[] getHoursArray()
- Get the hours value as an array
- Returns:
- The hoursArray value
isSetDate
public boolean isSetDate(int n)
- Is date n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setDate value
getDatesString
public java.lang.String getDatesString()
- Get the dates value as a String
- Returns:
- The datesString value
getDatesArray
public boolean[] getDatesArray()
- Get the dates value as an array
- Returns:
- The datesArray value
isSetMonth
public boolean isSetMonth(int n)
- Is month n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setMonth value
getMonthsString
public java.lang.String getMonthsString()
- Get the months value as a String
- Returns:
- The monthsString value
getMonthsArray
public boolean[] getMonthsArray()
- Get the months value as an array
- Returns:
- The monthsArray value
isSetYear
public boolean isSetYear(int n)
- Is year n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setYear value
getYearsString
public java.lang.String getYearsString()
- Get the years value as a String
- Returns:
- The yearsString value
getYearsArray
public boolean[] getYearsArray()
- Get the years value as an array
- Returns:
- The yearsArray value
isSetDay
public boolean isSetDay(int n)
- Is day of week n scheduled for execution?
- Parameters:
n
- Description of Parameter
- Returns:
- The setDay value
getDaysString
public java.lang.String getDaysString()
- Get the days of week value as a String
- Returns:
- The daysString value
getDaysArray
public boolean[] getDaysArray()
- Get the days of week value as an array
- Returns:
- The daysArray value
getClassName
public java.lang.String getClassName()
- Returns:
- the class that the event calls when activated
getArgs
public java.lang.String[] getArgs()
- Returns:
- the arguments passed to the thread.
parse
public void parse(java.lang.String str,
CrontabEntry.ParseSpec[] style)
throws CrontabParseException,
CrontabEmptyException
- Parses a string describing this crontab entry
- Parameters:
str
- String describing the time table entrystyle
- Description of Parameter
- Throws:
CrontabParseException
- Description of Exception
CrontabEmptyException
- Description of Exception
CrontabEntryException
- Error parsing the string
execute
public void execute()
- Start a thread to execute the class.
- Specified by:
execute
in interface CrontabEntryInterface
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
findNext
int findNext(int tm,
boolean[] array,
CrontabEntry.ParseSpec spec,
java.util.Calendar cal)
throws CrontabEmptyException
- Find the next occurance of an event within this array. If we search past
the end of the array and go back to the beginning then the "rotate"
variable is set to 1, otherwise it is set to 0.
- Parameters:
tm
- Description of Parameterarray
- Description of Parameter
- Returns:
- Description of the Returned Value
- Throws:
CrontabEmptyException
- Description of Exception
conformsTo
boolean conformsTo(boolean[] set,
int tm)
dateConformsTo
boolean dateConformsTo(java.util.Calendar date)
latterConforms
boolean latterConforms(java.util.Calendar cal,
CrontabEntry.ParseSpec spec)
nextEvent
public long nextEvent(long fromTime)
- When is the next event that occurs at or after fromTime? Note the tricky
code caused by the arrays being zero based but Calendar using a 1-based
system for DAY_OF_MONTH.
- Specified by:
nextEvent
in interface CrontabEntryInterface
- Parameters:
fromTime
- Description of Parameter
- Returns:
- Description of the Returned Value
ab2s
java.lang.String ab2s(boolean[] array)
- Helper class for toString(). formats an array of boolean.
- Parameters:
array
- Description of Parameter
- Returns:
- Description of the Returned Value
as2s
java.lang.String as2s(java.lang.String[] array)
- Helper class for toString(). formats an array of Strings.
- Parameters:
array
- Description of Parameter
- Returns:
- Description of the Returned Value