Class Period
- All Implemented Interfaces:
Scheduleable,Cloneable
- MinutesInDay
- DaysInMonth
- WeekDaysInMonth
- MonthsInYear
A Period can be used as an inclusion period or exclusion period in a Schedule. When a Period is used as an inclusion period, the Schedule is in-schedule when the Period is in-schedule. When a Period is used as an exclusion period, the Schedule is out-of-schedule when the Period is in-schedule.
MinutesInDay contains a set of 1440 continuous 1-minute intervals in a 24 hour period. Intervals of MinutesInDay can be accessed using an interger index value. The first interval starts at 12:00am has an index value of 0. The last interval is from 11:59pm with an index value of 1439. A MinutesInDay is in-schedule if the time for checking the schedule is included in the MinutesInDay. Otherwise, it is out-of-schedule.
DaysInMonth contains a set of 31 days in a month. A newly created period includes every day of the month. A day in DaysInMonth can be accessed using an integer index value. The first day starts at first of the month with an index value of 0. The last day is the 31th day with an index value of 30. The constant LAST_DAY_OF_MONTH should be used for last day of a month. A DaysInMonth is in-schedule if the day in the date for checking the schedule is included in the DaysInMonth. Otherwise, it is out-of-schedule. Including or excluding a day that a month does not contain will have no effect in the schedule. For example, excluding the 31st day for Febuary has no effect on the schedule.
WeekDaysInMonth contains a set of 7 days in a week. The first day of the week starts on Sunday and ends on Saturday. To include a day in WeekDaysInMonth in the schedule, useful constant are provided or integer index value of 0 to 6 may be used. Index value of 0 correspond to Sunday and 6 correspond to Saturday. There are 5 constants that can be used to indicate a particular weekday with in a month. They are:
- FIRST_WEEKDAY_OF_MONTH - for the first weekday of the month.
- SECOND_WEEKDAY_OF_MONTH - for the second weekday of the month.
- THIRD_WEEKDAY_OF_MONTH - for the third weekday of the month.
- FORTH_WEEKDAY_OF_MONTH - for the forth weekday of the month.
- LAST_WEEKDAY_OF_MONTH - for the last weekday of the month.
MonthsInYear contains a set of 12 months in a year. The first month of the year starts on January and ends on December. To include a month in MonthsInYear in the schedule, useful constant are provided or integer value of 0 to 11 may be used. Interger value of 0 correspond to January and 11 correspond to December. A MonthsInYear is in-schedule if the month of the date used for checking the schedule is included in the MonthsInYear. Otherwise, it is out-of-schedule.
Note that DaysInMonth and WeekDaysInMonth both contain day definition for the schedule - one in term of day of week and the other in term of day of month. If the same day in DaysInMonth or WeekDaysInMonth is out-of-schedule, that day is consider out-of-schedule. For example, if the WeekDaysInMonth in a Period includes weekdays (Monday to Friday), and the DaysInMonth in the same Period include the first day of the month. If the first day of the month is on Sunday, then period is out of schedule on the first day of the month eventhough it is included in DaysInMonth of the period.
The 4 components of the period is accessed from 5 common methods:
These methods take an argument to indicate which component that method is intended for. A constant is provided for each component to be used for the argument. They are:- MINUTES_IN_DAY for MinutesInDay
- WEEKDAYS_IN_MONTH for WeekDaysInMonth
- DAYS_IN_MONTH for DaysInMonth
- MONTHS_IN_YEAR for MonthsInYear
Period period = new Period();
period.include(WEEKDAYS_IN_MONTH, MONDAY);
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleDaysInMonthprotected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleDaysInWeekprotected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleMinutesInDayprotected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleMonthsInYearstatic final intA constant for including or excluding April.static final intA constant for including or excluding August.static final intA constant for days in month component in the period.static final intA constant for including or excluding December.static final intA constant for including or excluding Frebruary.static final intA constant for including first weekday in a month.static final intA constant for including forth weekday in a month.static final intA constant for including or excluding Friday.static final intA constant for including or excluding January.static final intA constant for including or excluding July.static final intA constant for including or excluding June.static final intA constant for including last day of a month.static final intA constant for including last weekday in a month.static final intA constant for including or excluding March.static final intA constant for including or excluding May.static final intA constant for time of day component in the period.static final intA constant for including or excluding Monday.static final intA constant for months in year component in the period.static final intA constant for including or excluding November.static final intA constant for the number of days in a DaysInMonth.static final intA constant for the number of days in a WeekDaysInMonth.static final intA constant for the number 15-minute intervals in TimeOfDay.static final intA constant for the number of minutes in MinutesInDay.static final intA constant for number of months in MonthsInYear.static final intA constant for including or excluding October.static final intA constant for including or excluding Saturday.static final intA constant for including second weekday in a month.static final intA constant for including or excluding September.static final intA constant for including or excluding Sunday.static final intA constant for including third weekday in a month.static final intA constant for including or excluding Thursday.static final intA constant for time of day component in the period.static final intA constant for including or excluding Tuesday.static final intA constant for including or excluding Wednesday.static final intA constant for weekdays in month component in the period. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of this Period.booleanCompares the specified object with this Period.voidexclude(int component, int index) Excludes the specific time period of a component in this Period.voidexcludeAll(int component) Excludes the entire time period of a component in this Period.COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleMinutesInDayDeprecated.voidinclude(int component, int index) Includes the specific time period of a component in this Period.voidincludeAll(int component) Includes the entire time period of a component in this Period.booleanChecks to see if this object is in schedule based on passed GregorianCalendar.booleanReturns false if the definition of the schedule components in the Period will cause it to be always excluded in the schedule.booleanisIncluded(int component, int index) Checks to see if a period within a component is included in this Period.toString()Returns a string reprensentation of this Period.toString(int iType) Deprecated.
-
Field Details
-
TIME_OF_DAY
public static final int TIME_OF_DAYA constant for time of day component in the period.- See Also:
-
WEEKDAYS_IN_MONTH
public static final int WEEKDAYS_IN_MONTHA constant for weekdays in month component in the period.- See Also:
-
DAYS_IN_MONTH
public static final int DAYS_IN_MONTHA constant for days in month component in the period.- See Also:
-
MONTHS_IN_YEAR
public static final int MONTHS_IN_YEARA constant for months in year component in the period.- See Also:
-
MINUTES_IN_DAY
public static final int MINUTES_IN_DAYA constant for time of day component in the period.- See Also:
-
NUM_OF_INTERVALS
public static final int NUM_OF_INTERVALSA constant for the number 15-minute intervals in TimeOfDay.- See Also:
-
NUM_OF_MINUTES
public static final int NUM_OF_MINUTESA constant for the number of minutes in MinutesInDay.- See Also:
-
NUM_OF_DAYS_IN_MONTH
public static final int NUM_OF_DAYS_IN_MONTHA constant for the number of days in a DaysInMonth.- See Also:
-
NUM_OF_DAYS_IN_WEEK
public static final int NUM_OF_DAYS_IN_WEEKA constant for the number of days in a WeekDaysInMonth.- See Also:
-
NUM_OF_MONTHS
public static final int NUM_OF_MONTHSA constant for number of months in MonthsInYear.- See Also:
-
SUNDAY
public static final int SUNDAYA constant for including or excluding Sunday.- See Also:
-
MONDAY
public static final int MONDAYA constant for including or excluding Monday.- See Also:
-
TUESDAY
public static final int TUESDAYA constant for including or excluding Tuesday.- See Also:
-
WEDNESDAY
public static final int WEDNESDAYA constant for including or excluding Wednesday.- See Also:
-
THURSDAY
public static final int THURSDAYA constant for including or excluding Thursday.- See Also:
-
FRIDAY
public static final int FRIDAYA constant for including or excluding Friday.- See Also:
-
SATURDAY
public static final int SATURDAYA constant for including or excluding Saturday.- See Also:
-
FIRST_WEEKDAY_OF_MONTH
public static final int FIRST_WEEKDAY_OF_MONTHA constant for including first weekday in a month.- See Also:
-
SECOND_WEEKDAY_OF_MONTH
public static final int SECOND_WEEKDAY_OF_MONTHA constant for including second weekday in a month.- See Also:
-
THIRD_WEEKDAY_OF_MONTH
public static final int THIRD_WEEKDAY_OF_MONTHA constant for including third weekday in a month.- See Also:
-
FOURTH_WEEKDAY_OF_MONTH
public static final int FOURTH_WEEKDAY_OF_MONTHA constant for including forth weekday in a month.- See Also:
-
LAST_WEEKDAY_OF_MONTH
public static final int LAST_WEEKDAY_OF_MONTHA constant for including last weekday in a month.- See Also:
-
LAST_DAY_OF_MONTH
public static final int LAST_DAY_OF_MONTHA constant for including last day of a month.- See Also:
-
JANUARY
public static final int JANUARYA constant for including or excluding January.- See Also:
-
FEBRUARY
public static final int FEBRUARYA constant for including or excluding Frebruary.- See Also:
-
MARCH
public static final int MARCHA constant for including or excluding March.- See Also:
-
APRIL
public static final int APRILA constant for including or excluding April.- See Also:
-
MAY
public static final int MAYA constant for including or excluding May.- See Also:
-
JUNE
public static final int JUNEA constant for including or excluding June.- See Also:
-
JULY
public static final int JULYA constant for including or excluding July.- See Also:
-
AUGUST
public static final int AUGUSTA constant for including or excluding August.- See Also:
-
SEPTEMBER
public static final int SEPTEMBERA constant for including or excluding September.- See Also:
-
OCTOBER
public static final int OCTOBERA constant for including or excluding October.- See Also:
-
NOVEMBER
public static final int NOVEMBERA constant for including or excluding November.- See Also:
-
DECEMBER
public static final int DECEMBERA constant for including or excluding December.- See Also:
-
_smid
protected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleMinutesInDay _smid -
_sdiw
protected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleDaysInWeek _sdiw -
_sdim
protected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleDaysInMonth _sdim -
_smiy
protected COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleMonthsInYear _smiy
-
-
Constructor Details
-
Period
public Period()Creates a Period. The new Period has no time, day, or month included.
-
-
Method Details
-
include
public void include(int component, int index) Includes the specific time period of a component in this Period.- Parameters:
component- the component of this Period.index- specific period to be included for the specified component.- See Also:
-
exclude
public void exclude(int component, int index) Excludes the specific time period of a component in this Period.- Parameters:
component- the component of this Period.index- specific period to be included for the specified component.- See Also:
-
includeAll
public void includeAll(int component) Includes the entire time period of a component in this Period.- Parameters:
component- the component of this Period.- See Also:
-
excludeAll
public void excludeAll(int component) Excludes the entire time period of a component in this Period.- Parameters:
component- the component of this Period.- See Also:
-
isIncluded
public boolean isIncluded(int component, int index) Checks to see if a period within a component is included in this Period.- Parameters:
component- the component of this Period.index- specific period of the specified component.- Returns:
- true if the period is included, false otherwise.
-
isAlwaysExcluded
public boolean isAlwaysExcluded()Returns false if the definition of the schedule components in the Period will cause it to be always excluded in the schedule. -
equals
Compares the specified object with this Period. -
clone
Returns a copy of this Period.- Overrides:
clonein classObject- Returns:
- a copy of this Period.
- Throws:
CloneNotSupportedException
-
getMinutesInDay
public COM.TIBCO.hawk.config.rbengine.schedule.impl.ScheduleMinutesInDay getMinutesInDay()Deprecated.Returns minutes in day component.- Returns:
- minutes in day component of this period.
-
toString
Deprecated.Returns a string reprensentation of the specified component of the period.- Parameters:
iType- the component type of the period.- Returns:
- a string reprensentation of the specified component of the period.
-
toString
Returns a string reprensentation of this Period. The string is a concatination of the string representation of the schedule components MinutesInDay, DaysInMonth, WeekDaysInMonth and MonthsInYear. -
inSchedule
Checks to see if this object is in schedule based on passed GregorianCalendar.- Specified by:
inSchedulein interfaceScheduleable- Parameters:
gc- GregorianCalendar for checking if this Period is in schedule.- Returns:
- true if this Period is in schedule.
-