|
PDAP Public Review Draft | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.pim.EventRepeat
Represents a description for a repeating pattern for an Event element. The fields are a subset of the capabilities of the RRULE field in VEVENT defined by the vCalendar 1.0 specification from the Internet Mail Consortium (http://www.imc.org). It is used on an Event to determine how often the Event occurs.
The following table shows the valid values for the fields that can be set in EventRepeat:
Field IDs | Set Method | Valid Values |
---|---|---|
COUNT |
setInt |
any positive int |
FREQUENCY |
setInt |
DAILY, WEEKLY, MONTHLY, YEARLY |
INTERVAL |
setInt |
any positive int |
END |
setDate |
any valid Date |
MONTH_IN_YEAR |
setInt |
JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST,
SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER |
DAY_IN_WEEK |
setInt |
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY |
WEEK_IN_MONTH |
setInt |
FIRST, SECOND, THIRD, FOURTH, FIFTH, LAST, SECONDLAST,
THIRDLAST, FOURTHLAST, FIFTHLAST |
DAY_IN_MONTH |
setInt |
1-31 |
DAY_IN_YEAR |
setInt |
1-366 |
The following examples demonstrate some possible repeat values.
To specify the associated event occurs every day: setInt(EventRepeat.FREQUENCY, EventRepeat.DAILY);
To specify the associated event occurs every day for the next five days: setInt(EventRepeat.FREQUENCY, EventRepeat.DAILY);
setInt(EventRepeat.COUNT, 5);
To specify this event occurs every week on Monday and Tuesday: setInt(EventRepeat.FREQUENCY, EventRepeat.WEEKLY);
setInt(EventRepeat.DAY_IN_WEEK, EventRepeat.MONDAY | EventRepeat.TUESDAY);
To specify the associated event occurs every third week on Friday: setInt(EventRepeat.FREQUENCY, EventRepeat.WEEKLY);
setInt(EventRepeat.INTERVAL, 3);
setInt(EventRepeat.DAY_IN_WEEK, EventRepeat.FRIDAY);
To specify the associated event occurs every month on the Wednesday of the second week until the end of the current year: setInt(EventRepeat.FREQUENCY, EventRepeat.MONTHLY);
setInt(EventRepeat.WEEK_IN_MONTH, EventRepeat.SECOND);
setInt(EventRepeat.DAY_IN_WEEK, EventRepeat.WEDNESDAY);
java.util.Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, 12);
cal.set(Calendar.DAY_OF_MONTH, 31);
cal.set(Calendar.AM_PM, Calendar.PM);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
setDate(EventRepeat.END, cal.getTime().getTime());
To specify the associated event occurs every year on the Sunday of the second week in May: setInt(EventRepeat.FREQUENCY, EventRepeat.YEARLY);
setInt(EventRepeat.MONTH_IN_YEAR, EventRepeat.MAY);
setInt(EventRepeat.WEEK_IN_MONTH, EventRepeat.SECOND);
setInt(EventRepeat.DAY_IN_WEEK, EventRepeat.SUNDAY);
To specify the associated event occurs every year on the 4th of July: setInt(EventRepeat.FREQUENCY, EventRepeat.YEARLY);
setInt(EventRepeat.MONTH_IN_YEAR, EventRepeat.JULY);
setInt(EventRepeat.DAY_IN_MONTH, 4);
To specify the associated event occurs every year on the first day: setInt(EventRepeat.FREQUENCY, EventRepeat.YEARLY);
setInt(EventRepeat.DAY_IN_YEAR, 1);
Field Summary | |
static int |
APRIL
Constant for the month of April. |
static int |
AUGUST
Constant for the month of August. |
static int |
COUNT
The number of times this event repeats including the first time, starting from the first time the event starts (derived from Event.START ) and continuing to the last date of
the repeat (defined by EventRepeat.END . |
static int |
DAILY
Used for frequency when the Event happens every day. |
static int |
DAY_IN_MONTH
The day of the month an Event occurs; for example, 15. |
static int |
DAY_IN_WEEK
The days of the week an Event occurs. |
static int |
DAY_IN_YEAR
The day of the year an Event occurs; for example, 134. |
static int |
DECEMBER
Constant for the month of December. |
static int |
END
The ending date of the repeating event. |
static int |
FEBRUARY
Constant for the month of February. |
static int |
FIFTH
Constant for the fifth week of the month. |
static int |
FIFTHLAST
Constant for the fifth to last week of the month. |
static int |
FIRST
Constant for the first week of the month. |
static int |
FOURTH
Constant for the fourth week of the month. |
static int |
FOURTHLAST
Constant for the fourth to last week of the month. |
static int |
FREQUENCY
The frequency of the Repeat. |
static int |
FRIDAY
Constant for the day of week Friday. |
static int |
INTERVAL
The number of iterations of the frequency between occurring dates, or how often the frequency repeats. |
static int |
JANUARY
Constant for the month of January. |
static int |
JULY
Constant for the month of July. |
static int |
JUNE
Constant for the month of June. |
static int |
LAST
Constant for the last week of the month. |
static int |
MARCH
Constant for the month of March. |
static int |
MAY
Constant for the month of May. |
static int |
MONDAY
Constant for the day of week Monday. |
static int |
MONTH_IN_YEAR
The month an event occurs. |
static int |
MONTHLY
Used for frequency when the Event happens every month. |
static int |
NOVEMBER
Constant for the month of November. |
static int |
OCTOBER
Constant for the month of October. |
static int |
SATURDAY
Constant for the day of week Saturday. |
static int |
SECOND
Constant for the second week of the month. |
static int |
SECONDLAST
Constant for the second to last week of the month. |
static int |
SEPTEMBER
Constant for the month of September. |
static int |
SUNDAY
Constant for the day of week Sunday. |
static int |
THIRD
Constant for the third week of the month. |
static int |
THIRDLAST
Constant for the third to last week of the month. |
static int |
THURSDAY
Constant for the day of week Thursday. |
static int |
TUESDAY
Constant for the day of week Tuesday. |
static int |
WEDNESDAY
Constant for the day of week Wednesday. |
static int |
WEEK_IN_MONTH
Which week in a month a particular event occurs. |
static int |
WEEKLY
Used for frequency when the Event happens every week. |
static int |
YEARLY
Used for frequency when the Event happens every year. |
Constructor Summary | |
EventRepeat()
|
Method Summary | |
void |
addExceptDate(long date)
Add a Date for which this RepeatPattern should not occur. |
Enumeration |
dates(long startDate,
long beginning,
long ending)
Returns an Enumeration of Dates on which an Event would occur. |
long |
getDate(int fieldID)
Retrieves a Date field. |
long[] |
getExceptDates()
Returns the Dates for which this RepeatPattern should not occur. |
int |
getInt(int fieldID)
Retrieves an int field. |
void |
removeExceptDate(long date)
Remove a Date for which this RepeatPattern should not occur. |
void |
setDate(int fieldID,
long value)
Sets a Date field. |
void |
setInt(int fieldID,
int value)
Sets an int field. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int COUNT
Event.START
) and continuing to the last date of
the repeat (defined by EventRepeat.END
.
COUNT controls the number of times the event occurs during
the period is used with EventRepeat interval and the frequency to
calculate when the event will occur. EventRepeat.END
overrides this data if the end is reached prior to the count finishing.
If COUNT
is 0 and END
is null
,
the event repeats forever.
Value 1 is assigned to COUNT
.
public static final int FREQUENCY
DAILY
,
WEEKLY
, MONTHLY
or YEARLY
.
Value 2 is assigned to FREQUENCY
.
public static final int INTERVAL
FREQUENCY
is
DAILY
and INTERVAL
is 2.
Value 3 is assigned to INTERVAL
.
public static final int END
END
.public static final int MONTH_IN_YEAR
JANUARY | FEBRUARY
).
Value 5 is assigned to MONTH_IN_YEAR
.
public static final int WEEK_IN_MONTH
FIRST | LAST | SECOND | SECONDLAST
).
Value 6 is assigned to WEEK_IN_MONTH
.
public static final int DAY_IN_WEEK
MONDAY | THURSDAY
).
Value 7 is assigned to DAY_IN_WEEK
.
public static final int DAY_IN_MONTH
Value 8 is assigned to DAY_IN_MONTH
.
public static final int DAY_IN_YEAR
Value 9 is assigned to DAY_IN_YEAR
.
public static final int DAILY
Value 0x10 is assigned to DAILY
.
public static final int WEEKLY
Value 0x11 is assigned to WEEKLY.
public static final int MONTHLY
Value 0x12 is assigned to MONTHLY.
public static final int YEARLY
Value 0x13 is assigned to YEARLY.
public static final int FIRST
Value 0x1 is assigned to FIRST.
public static final int SECOND
Value 0x2 is assigned to SECOND.
public static final int THIRD
Value 0x4 is assigned to THIRD.
public static final int FOURTH
Value 0x8 is assigned to FOURTH.
public static final int FIFTH
Value 0x10 is assigned to FIFTH.
public static final int LAST
Value 0x20 is assigned to LAST.
public static final int SECONDLAST
Value 0x40 is assigned to SECONDLAST.
public static final int THIRDLAST
Value 0x80 is assigned to THIRDLAST.
public static final int FOURTHLAST
Value 0x100 is assigned to FOURTHLAST.
public static final int FIFTHLAST
Value 0x200 is assigned to FIFTHLAST.
public static final int SATURDAY
Value 0x400 is assigned to SATURDAY.
public static final int FRIDAY
Value 0x800 is assigned to FRIDAY.
public static final int THURSDAY
Value 0x1000 is assigned to THURSDAY.
public static final int WEDNESDAY
Value 0x2000 is assigned to WEDNESDAY.
public static final int TUESDAY
Value 0x4000 is assigned to TUESDAY.
public static final int MONDAY
Value 0x8000 is assigned to MONDAY.
public static final int SUNDAY
Value 0x10000 is assigned to SUNDAY.
public static final int JANUARY
Value 0x20000 is assigned to JANUARY.
public static final int FEBRUARY
Value 0x40000 is assigned to FEBRUARY.
public static final int MARCH
Value 0x80000 is assigned to MARCH.
public static final int APRIL
Value 0x100000 is assigned to APRIL.
public static final int MAY
Value 0x200000 is assigned to MAY.
public static final int JUNE
Value 0x400000 is assigned to JUNE.
public static final int JULY
Value 0x800000 is assigned to JULY.
public static final int AUGUST
Value 0x1000000 is assigned to AUGUST.
public static final int SEPTEMBER
Value 0x2000000 is assigned to SEPTEMBER.
public static final int OCTOBER
Value 0x4000000 is assigned to OCTOBER.
public static final int NOVEMBER
Value 0x8000000 is assigned to NOVEMBER.
public static final int DECEMBER
Value 0x10000000 is assigned to DECEMBER.
Constructor Detail |
public EventRepeat()
Method Detail |
public Enumeration dates(long startDate, long beginning, long ending)
startDate
- the start date for the sequencebeginning
- the beginning of the period for which events should be returnedending
- the end of the period for which events should be returned or null
to specify all events until there are no more occurences.public void addExceptDate(long date)
the
- date in long ms format to add to the list of except datespublic void removeExceptDate(long date)
the
- date in long ms format to remove from the list of except datespublic long[] getExceptDates()
public int getInt(int fieldID)
COUNT, DAYNUMBER, FREQUENCY, INTERVAL, MONTH_IN_YEAR,
WEEK_IN_MONTH, DAY_IN_WEEK, DAY_IN_YEAR
.fieldID
- The field ID to get, for example COUNT
.java.lang.IllegalArgumentException
- if fieldID is not one of the
the valid EventRepeat field IDs for this method.public void setInt(int fieldID, int value)
COUNT, DAYNUMBER, FREQUENCY, INTERVAL, MONTH_IN_YEAR,
WEEK_IN_MONTH, DAY_IN_WEEK, DAY_IN_YEAR
.fieldID
- The field ID to set, for example COUNT
.value
- The value to set the field to.java.lang.IllegalArgumentException
- if fieldID is not one of the
the valid EventRepeat field IDs for this method.public long getDate(int fieldID)
END
.fieldID
- The field ID to get.java.lang.IllegalArgumentException
- if fieldID is not one of the
the valid EventRepeat field IDs for this method.public void setDate(int fieldID, long value)
END
.fieldID
- The field ID to set.value
- The value to set the field to. Setting a field to null
has the
effect of clearing it.java.lang.IllegalArgumentException
- if fieldID is not one of the
the valid EventRepeat field IDs for this method
or value is null
.
|
PDAP 1.0 Spec, Rev. 0.16 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |