javax.microedition.pim
Class RepeatRule

java.lang.Object
  extended by javax.microedition.pim.RepeatRule

public class RepeatRule
extends Object

Represents a description for a repeating pattern for an Event item. 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 use to determine how often an associated Event occurs.

The fields of a Repeat Rule can conceptually be grouped into two categories:

This means that a Repeat Rule's calculation of applicable dates starts with a repeating frequency (such as weekly, daily, yearly, or monthly) and then other fields refine or modify the repeat characteristics according to the field (e.g. the COUNT field specifies that only X repeat occurrences happen at the given frequency). The first category contains only FREQUENCY, while all other repeat rule fields are classified in the second category. This classification of the fields aids in understanding of the relationship of the fields and allows for a method to query for supported fields (see EventList.getSupportedRepeatRuleFields(int)).

A repeat rule typically needs to have its frequency set first and foremost. The following table shows the valid values for the frequency fields that can be set in RepeatRule:

Fields Set Method Valid Values
FREQUENCY setInt DAILY, WEEKLY, MONTHLY, YEARLY

The following table shows the valid values for the fields that modify or refine the frequency of a RepeatRule:

Fields Set Method Valid Values
COUNT setInt any positive int
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 (Note: that these are constants defined in the RepeatRule class and are not the same as those in the Calendar class)
DAY_IN_WEEK setInt SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY (Note: that these are constants defined in the RepeatRule class and are not the same as those in the Calendar class)
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

Examples

The following examples demonstrate some possible repeat values.

To specify the associated event occurs every day:

 setInt( RepeatRule.FREQUENCY, RepeatRule.DAILY );
 
To specify the associated event occurs every day for the next five days:

 setInt( RepeatRule.FREQUENCY, RepeatRule.DAILY );
 setInt( RepeatRule.COUNT, 5 );
 
To specify this event occurs every week on Monday and Tuesday:

 setInt( RepeatRule.FREQUENCY, RepeatRule.WEEKLY );
 setInt( RepeatRule.DAY_IN_WEEK, RepeatRule.MONDAY | RepeatRule.TUESDAY );
 
To specify the associated event occurs every third week on Friday:

 setInt( RepeatRule.FREQUENCY, RepeatRule.WEEKLY );
 setInt( RepeatRule.INTERVAL, 3 );
 setInt( RepeatRule.DAY_IN_WEEK, RepeatRule.FRIDAY );
 
To specify the associated event occurs every month on the Wednesday of the second week until the end of the current year:

 setInt( RepeatRule.FREQUENCY, RepeatRule.MONTHLY );
 setInt( RepeatRule.WEEK_IN_MONTH, RepeatRule.SECOND );
 setInt( RepeatRule.DAY_IN_WEEK, RepeatRule.WEDNESDAY );
 java.util.Calendar cal = Calendar.getInstance();
 cal.set( Calendar.MONTH, Calendar.DECEMBER );
 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( RepeatRule.END, cal.getTime().getTime() );
 
To specify the associated event occurs every year on the Sunday of the second week in May:

 setInt( RepeatRule.FREQUENCY, RepeatRule.YEARLY );
 setInt( RepeatRule.MONTH_IN_YEAR, RepeatRule.MAY );
 setInt( RepeatRule.WEEK_IN_MONTH, RepeatRule.SECOND );
 setInt( RepeatRule.DAY_IN_WEEK, RepeatRule.SUNDAY );
 
To specify the associated event occurs every year on the 4th of July:

 setInt( RepeatRule.FREQUENCY, RepeatRule.YEARLY );
 setInt( RepeatRule.MONTH_IN_YEAR, RepeatRule.JULY );
 setInt( RepeatRule.DAY_IN_MONTH, 4 );
 
To specify the associated event occurs every year on the first day:

 setInt( RepeatRule.FREQUENCY, RepeatRule.YEARLY );
 setInt( RepeatRule.DAY_IN_YEAR, 1 );
 
To check if a particular Repeat Rule frequency value is supported for events for a certain event list:

 // Check if RepeatRule.DAILY is supported in the default event list * 
 EventList el = PIM.openPIMList( PIM.EVENT_LIST, PIM.READ_WRITE );
 int[] supported_fields = el.getSupportedRepeatRuleFields( RepeatRule.DAILY );
 if( supported_fields.length > 0 ) {
     System.out.println( "RepeatRule.DAILY is supported in default event list" );
 }
 
To check if a particular Repeat Rule field is supported for events for a certain event list:

 // Check if RepeatRule.INTERVAL is supported for DAILY frequency events
 
 EventList el = PIM.openPIMList( PIM.EVENT_LIST, PIM.READ_WRITE );
 int[] supported_fields = el.getSupportedRepeatRuleFields( RepeatRule.DAILY );
 int i = 0;
 while( i < supported_fields.length )
     if( supported_fields[ i ] & RepeatRule.INTERVAL != 0 ) {
         System.out.println( "INTERVAL supported in default event list" );
         break;
     }
 

The PDA Profile specification (JSR-75) for the J2ME(TM) Platform

For more information about this class or about the personal information management (PIM) API, see The PDA Profile specification (JSR-000075) for the J2ME(TM) Platform.

See Also:
Event.setRepeat(RepeatRule), Event.getRepeat()
Since:
BlackBerry API 4.0.0, PIM 1.0

Field Summary
static int APRIL
          Constant for the month of April used with MONTH_IN_YEAR field.
static int AUGUST
          Constant for the month of August used with MONTH_IN_YEAR field.
static int COUNT
          Field specifying 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 RepeatRule.END).
static int DAILY
          Used for frequency when the Event happens every day.
static int DAY_IN_MONTH
          Field specifying the day of the month an Event occurs; for example, 15.
static int DAY_IN_WEEK
          Field specifying the days of the week an Event occurs.
static int DAY_IN_YEAR
          Field specifying the day of the year an Event occurs; for example, 134.
static int DECEMBER
          Constant for the month of December used with MONTH_IN_YEAR field.
static int END
          Field specifying the ending date of the repeating event.
static int FEBRUARY
          Constant for the month of February used with MONTH_IN_YEAR field.
static int FIFTH
          Constant for the fifth week of the month used with WEEK_IN_MONTH field.
static int FIFTHLAST
          Constant for the fifth to last week of the month used with WEEK_IN_MONTH field.
static int FIRST
          Constant for the first week of the month used with WEEK_IN_MONTH field.
static int FOURTH
          Constant for the fourth week of the month used with WEEK_IN_MONTH field.
static int FOURTHLAST
          Constant for the fourth to last week of the month used with WEEK_IN_MONTH field.
static int FREQUENCY
          Field specifying the frequency of the Repeat.
static int FRIDAY
          Constant for the day of week Friday used with DAY_IN_WEEK field.
static int INTERVAL
          Field specifying 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 used with MONTH_IN_YEAR field.
static int JULY
          Constant for the month of July used with MONTH_IN_YEAR field.
static int JUNE
          Constant for the month of June used with MONTH_IN_YEAR field.
static int LAST
          Constant for the last week of the month used with WEEK_IN_MONTH field.
static int MARCH
          Constant for the month of March used with MONTH_IN_YEAR field.
static int MAY
          Constant for the month of May used with MONTH_IN_YEAR field.
static int MONDAY
          Constant for the day of week Monday used with DAY_IN_WEEK field.
static int MONTHLY
          Used for frequency when the Event happens every month.
static int MONTH_IN_YEAR
          Field specifying the month in which an event occurs.
static int NOVEMBER
          Constant for the month of November used with MONTH_IN_YEAR field.
static int OCTOBER
          Constant for the month of October used with MONTH_IN_YEAR field.
static int SATURDAY
          Constant for the day of week Saturday used with DAY_IN_WEEK field.
static int SECOND
          Constant for the second week of the month used with WEEK_IN_MONTH field.
static int SECONDLAST
          Constant for the second to last week of the month used with WEEK_IN_MONTH field.
static int SEPTEMBER
          Constant for the month of September used with MONTH_IN_YEAR field.
static int SUNDAY
          Constant for the day of week Sunday used with DAY_IN_WEEK field.
static int THIRD
          Constant for the third week of the month used with WEEK_IN_MONTH field.
static int THIRDLAST
          Constant for the third to last week of the month used with WEEK_IN_MONTH field.
static int THURSDAY
          Constant for the day of week Thursday used with DAY_IN_WEEK field.
static int TUESDAY
          Constant for the day of week Tuesday used with DAY_IN_WEEK field.
static int WEDNESDAY
          Constant for the day of week Wednesday used with DAY_IN_WEEK field.
static int WEEKLY
          Used for frequency when the Event happens every week.
static int WEEK_IN_MONTH
          Field specifying which week in a month a particular event occurs.
static int YEARLY
          Used for frequency when the Event happens every year.
 
Constructor Summary
RepeatRule()
          Creates a new RepeatRule instance.
 
Method Summary
 void addExceptDate(long date)
          Add a Date for which this RepeatRule should not occur.
 Enumeration dates(long startDate, long subsetBeginning, long subsetEnding)
          Returns an Enumeration of dates on which an Event would occur.
 boolean equals(Object obj)
          Compares this RepeatRule with a given RepeatRule for content equality.
 long getDate(int field)
          Retrieves a date field.
 Enumeration getExceptDates()
          Returns the Dates for which this RepeatRule should not occur.
 int[] getFields()
          Returns a list of fields that currently have values assigned.
 int getInt(int field)
          Retrieves an integer field.
 void removeExceptDate(long date)
          Remove a Date for which this RepeatRule should not occur.
 void setDate(int field, long value)
          Sets the value of a date field.
 void setInt(int field, int value)
          Sets the value of an integer field.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

COUNT

public static final int COUNT
Field specifying 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 RepeatRule.END). COUNT controls the number of times the event occurs during the period and is used with RepeatRule interval and the frequency to calculate when the event occurs. RepeatRule.END overrides this data if the end is reached prior to the count finishing. If COUNT is 0 (zero) and END is null, the event repeats forever.

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

DAY_IN_MONTH

public static final int DAY_IN_MONTH
Field specifying the day of the month an Event occurs; for example, 15. This value is 1 based from the first day of the month.

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

DAY_IN_WEEK

public static final int DAY_IN_WEEK
Field specifying the days of the week an Event occurs. To set multiple days, bitwise-OR the values together (e.g. MONDAY|THURSDAY). Retrieval of data for this field can contain multiple days bitwise-OR'd together in the same manner as setting the value.

Valid values for this field are:

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

DAY_IN_YEAR

public static final int DAY_IN_YEAR
Field specifying the day of the year an Event occurs; for example, 134. This value is 1 based from the first day of the beginning of the year.

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

END

public static final int END
Field specifying the ending date of the repeating event. Data for this field is expressed in the same long value format as Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970).

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FREQUENCY

public static final int FREQUENCY
Field specifying the frequency of the Repeat. This field has a value of either DAILY, WEEKLY, MONTHLY or YEARLY. The default data value associated with this field in RepeatRule is DAILY.

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

INTERVAL

public static final int INTERVAL
Field specifying the number of iterations of the frequency between occurring dates, or how often the frequency repeats. For example, for every other day the FREQUENCY is DAILY and INTERVAL is 2. The default value for data associated with this field is 1.

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

MONTH_IN_YEAR

public static final int MONTH_IN_YEAR
Field specifying the month in which an event occurs. To set multiple months, bitwise-OR the values together (e.g. JANUARY|FEBRUARY). Retrieval of data for this field can contain multiple months bitwise-OR'd together in the same manner as setting the value.

Valid values for this field are:

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

WEEK_IN_MONTH

public static final int WEEK_IN_MONTH
Field specifying which week in a month a particular event occurs. To set multiple weeks, bitwise-OR the values together (e.g. FIRST|LAST|SECOND|SECONDLAST). Retrieval of data for this field can contain multiple weeks bitwise-OR'd together in the same manner as setting the value.

Valid values for this field are:

This field can be checked for support by EventList.getSupportedRepeatRuleFields(int).

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

DAILY

public static final int DAILY
Used for frequency when the Event happens every day.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

WEEKLY

public static final int WEEKLY
Used for frequency when the Event happens every week.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

MONTHLY

public static final int MONTHLY
Used for frequency when the Event happens every month.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

YEARLY

public static final int YEARLY
Used for frequency when the Event happens every year.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FIRST

public static final int FIRST
Constant for the first week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

SECOND

public static final int SECOND
Constant for the second week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

THIRD

public static final int THIRD
Constant for the third week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FOURTH

public static final int FOURTH
Constant for the fourth week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FIFTH

public static final int FIFTH
Constant for the fifth week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

LAST

public static final int LAST
Constant for the last week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

SECONDLAST

public static final int SECONDLAST
Constant for the second to last week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

THIRDLAST

public static final int THIRDLAST
Constant for the third to last week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FOURTHLAST

public static final int FOURTHLAST
Constant for the fourth to last week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FIFTHLAST

public static final int FIFTHLAST
Constant for the fifth to last week of the month used with WEEK_IN_MONTH field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

SATURDAY

public static final int SATURDAY
Constant for the day of week Saturday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FRIDAY

public static final int FRIDAY
Constant for the day of week Friday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

THURSDAY

public static final int THURSDAY
Constant for the day of week Thursday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

WEDNESDAY

public static final int WEDNESDAY
Constant for the day of week Wednesday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

TUESDAY

public static final int TUESDAY
Constant for the day of week Tuesday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

MONDAY

public static final int MONDAY
Constant for the day of week Monday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

SUNDAY

public static final int SUNDAY
Constant for the day of week Sunday used with DAY_IN_WEEK field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

JANUARY

public static final int JANUARY
Constant for the month of January used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

FEBRUARY

public static final int FEBRUARY
Constant for the month of February used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

MARCH

public static final int MARCH
Constant for the month of March used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

APRIL

public static final int APRIL
Constant for the month of April used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

MAY

public static final int MAY
Constant for the month of May used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

JUNE

public static final int JUNE
Constant for the month of June used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

JULY

public static final int JULY
Constant for the month of July used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

AUGUST

public static final int AUGUST
Constant for the month of August used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

SEPTEMBER

public static final int SEPTEMBER
Constant for the month of September used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

OCTOBER

public static final int OCTOBER
Constant for the month of October used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

NOVEMBER

public static final int NOVEMBER
Constant for the month of November used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

DECEMBER

public static final int DECEMBER
Constant for the month of December used with MONTH_IN_YEAR field.

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0


Constructor Detail

RepeatRule

public RepeatRule()
Creates a new RepeatRule instance.

Since:
BlackBerry API 4.0.0


Method Detail

dates

public Enumeration dates(long startDate,
                         long subsetBeginning,
                         long subsetEnding)
Returns an Enumeration of dates on which an Event would occur. A start date is specified from which the repeating rule is applied to generate dates. Then a beginning date and a start date is also provided to return only a subset of all possible occurrences of an Event within the given timeframe. The sequence of the items is by date.

Exceptional dates are not included in the returned Enumeration. For example, an Event may happen every Monday during a year starting on January 1st. However, one wants to know occurrences of the Event during the month of June only. The startDate parameter specifies the anchor point for the Event from which it begins repeating, and the subsetBeginning and subsetEnding parameters would limit the Events returned to those only in June in this example.

Parameters:
startDate - the start date for the sequence, from which the repeat rule is applied to generate possible occurrence dates. This value must be expressed in the same long value format as Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
subsetBeginning - the beginning date of the period for which events should be returned. This value must be expressed in the same long value format as Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
subsetEnding - the end date of the period for which events should be returned. This value must be expressed in the same long value format as Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
Returns:
an Enumeration of dates for the given parameters, with the Enumeration containing Date instances.
Since:
BlackBerry API 4.0.0

addExceptDate

public void addExceptDate(long date)
Add a Date for which this RepeatRule should not occur. This value may be rounded off to the date only from a date time stamp if the underlying platform implementation only supports date fields with dates only and not date time stamps.

Parameters:
date - the date to add to the list of except dates, expressed in the same long value format as Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
See Also:
RepeatRule.getExceptDates(), RepeatRule.removeExceptDate(long)
Since:
BlackBerry API 4.0.0

removeExceptDate

public void removeExceptDate(long date)
Remove a Date for which this RepeatRule should not occur. If the date was in the list of except dates, it is removed; otherwise, does nothing.

Parameters:
date - the date to remove from the list of except dates expressed in the same long value format as Date, which is milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
See Also:
RepeatRule.addExceptDate(long), RepeatRule.getExceptDates()
Since:
BlackBerry API 4.0.0

getExceptDates

public Enumeration getExceptDates()
Returns the Dates for which this RepeatRule should not occur.

Returns:
an Enumeration of dates for which this RepeatRule should not occur, with the Enumeration containing Date instances.
See Also:
RepeatRule.addExceptDate(long), RepeatRule.removeExceptDate(long)
Since:
BlackBerry API 4.0.0

getInt

public int getInt(int field)
Retrieves an integer field. The RepeatRule.getFields() method should be checked prior to invoking the method to ensure the field has a value associated with it.

Parameters:
field - the field whose value to get; valid values are RepeatRule.COUNT, RepeatRule.DAY_IN_MONTH, RepeatRule.FREQUENCY, RepeatRule.INTERVAL, RepeatRule.MONTH_IN_YEAR, RepeatRule.WEEK_IN_MONTH, RepeatRule.DAY_IN_WEEK, and RepeatRule.DAY_IN_YEAR.
Returns:
the value for the specified field.
Throws:
IllegalArgumentException - if field is not one of the the valid RepeatRule fields for this method.
FieldEmptyException - if the field is a valid integer field but does not have any data values assigned to it.
See Also:
RepeatRule.setInt(int, int), RepeatRule.getFields()
Since:
BlackBerry API 4.0.0

setInt

public void setInt(int field,
                   int value)
Sets the value of an integer field.

Parameters:
field - the field whose value to set; valid values are RepeatRule.COUNT, RepeatRule.DAY_IN_MONTH, RepeatRule.FREQUENCY, RepeatRule.INTERVAL, RepeatRule.MONTH_IN_YEAR, RepeatRule.WEEK_IN_MONTH, RepeatRule.DAY_IN_WEEK, and RepeatRule.DAY_IN_YEAR.
value - the value to set the field to.
Throws:
IllegalArgumentException - if field is not one of the the valid RepeatRule fields for this method.
See Also:
RepeatRule.getInt(int), RepeatRule.getFields()
Since:
BlackBerry API 4.0.0

getDate

public long getDate(int field)
Retrieves a date field. The RepeatRule.getFields() method should be checked prior to invoking the method to ensure the field has a value associated with it.

Parameters:
field - the field whose value to get; the only valid value is RepeatRule.END
Returns:
the value for the specified field.
Throws:
IllegalArgumentException - if field is not one of the the valid RepeatRule fields for this method.
FieldEmptyException - if the field is a valid date field but does not have any data values assigned to it.
See Also:
RepeatRule.setDate(int, long), RepeatRule.getFields()
Since:
BlackBerry API 4.0.0

setDate

public void setDate(int field,
                    long value)
Sets the value of a date field.

Parameters:
field - the field whose value to set; the only valid value is RepeatRule.END
value - the value to set the field to.
Throws:
IllegalArgumentException - if field is not one of the the valid RepeatRule fields for this method.
See Also:
RepeatRule.getDate(int), RepeatRule.getFields()
Since:
BlackBerry API 4.0.0

getFields

public int[] getFields()
Returns a list of fields that currently have values assigned. If a field is not "set", the field is not included in the return value.

Returns:
an array of fields that have values currently assigned to them. If no fields have values set, an array of zero length is returned.
Since:
BlackBerry API 4.0.0

equals

public boolean equals(Object obj)
Compares this RepeatRule with a given RepeatRule for content equality. For RepeatRules, dates are considered equal if one or both of the dates compared contains a date only with no timestamp and the date values are equal regardless of the time qualifier. This rule accounts for platform dependent rounding off of dates from date time stamps to dates only. For example, a date value of 3/14/03 with no time stamp is considered equal to a date value of 3/14/03 with a time stamp. If the application requires that dates be exactly equal, comparisons should be made explicitly outside of this method.

Overrides:
equals in class Object
Parameters:
obj - the object to compare to this object
Returns:
true if obj is a non-null instance of RepeatRule and its contents are equivalent to this Repeat Rule's contents; false otherwise.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 4.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.