|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
COM.FutureTense.Util.TimePattern
public class TimePattern
This class represents a scheduled time, using a syntax similar to the UNIX 'cron' syntax. The format is described as follows:
hh:mm:ss W/DD/MM
hh: 0 - 23
mm: 0 - 59
ss: 0 - 59
W (day of the week): 0 - 6 with 0 = Sunday.
DD (day of the month): 1 - 31
MM (month): 1 - 12
Each of these fields may be either an asterisk (meaning all legal values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign indicating an inclusive range. For example, 2, 5 - 7:0:0 5/*\/* means the event is triggered at 2 AM, 5AM, 6 AM and 7 AM every Friday. The specification of days can be made by two fields: day of the month (DD) and day of the week (W). If both are specified, both take effect. For example, 1:0:0 1/15/* means the event is triggered at 1 AM every Monday, as well as on the fifteenth of each month. To specify days by only one field, set the other field to *.
This class is immutable, thread-safe, and serializable.
Field Summary | |
---|---|
static java.lang.String |
IMMEDIATE TimePattern string representing a pattern that always matches |
static TimePattern |
IMMEDIATE_TIMEPATTERN TimePattern that matches every instant in time |
static java.lang.String |
NEVER TimePattern string representing a pattern that will never be matched. |
static TimePattern |
NEVER_TIMEPATTERN TimePattern that never matches any instant in time |
static java.lang.String |
sImmediate Deprecated. use IMMEDIATE |
static java.lang.String |
sNever Deprecated. use NEVER |
Constructor Summary | |
---|---|
TimePattern(java.lang.String pattern) Deprecated. use valueOf(String) instead |
Method Summary | |
---|---|
static TimePattern |
getTimePattern(java.lang.String tp) Deprecated. (use valueOf(String) instead) |
boolean |
matches(java.util.Calendar time) Determines if this TimePattern has had a match between the specified time, and right now. |
boolean |
never() Return whether this timepattern is designed to never match |
java.util.Calendar |
nextMatch(java.util.Calendar rangeStart, java.util.Calendar rangeEnd) Get the next match for this TimePattern between the two dates passed in |
java.util.Date |
nextMatch(java.util.Date rangeStart, java.util.Date rangeEnd) Get the next match for this TimePattern between the two dates passed in |
boolean |
now() Return whether or not this TimePattern matches every instant in time. |
java.lang.String |
toString() Return the string representation of a time pattern |
static TimePattern |
valueOf(java.lang.String pattern) Return an instance of a TimePattern object given the input string specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NEVER
public static final java.lang.String IMMEDIATE
public static final java.lang.String sNever
public static final java.lang.String sImmediate
public static final TimePattern NEVER_TIMEPATTERN
public static final TimePattern IMMEDIATE_TIMEPATTERN
Constructor Detail |
---|
public TimePattern(java.lang.String pattern)
pattern
- time pattern stringjava.lang.IllegalArgumentException
- if the TimePattern is invalidMethod Detail |
---|
public static final TimePattern valueOf(java.lang.String pattern)
pattern
- TimePattern stringjava.lang.IllegalArgumentException
- if the pattern specified is now well-formed.public static final TimePattern getTimePattern(java.lang.String tp)
tp
- time pattern stringjava.lang.IllegalArgumentException
- on invalid datapublic java.lang.String toString()
toString
in class java.lang.Object
public boolean never()
public boolean now()
public boolean matches(java.util.Calendar time)
time
- The last time this TimePattern had a match.public java.util.Date nextMatch(java.util.Date rangeStart, java.util.Date rangeEnd)
rangeStart
- Find the next match after this daterangeEnd
- Find the next match before this matchpublic java.util.Calendar nextMatch(java.util.Calendar rangeStart, java.util.Calendar rangeEnd)
rangeStart
- Find the next match after this daterangeEnd
- Find the next match before this match
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.