📄 repeatrule.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>RepeatRule (PIM Optional Package 1.0 Spec, Final Release) </TITLE>
<!-- Generated by javadoc on Wed Oct 29 13:13:41 PST 2003 -->
<META NAME="keywords" CONTENT="javax.microedition.pim.RepeatRule,RepeatRule class">
<LINK REL="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT>
function asd()
{
parent.document.title="RepeatRule (PIM Optional Package 1.0 Spec, Final Release)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN="3" BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#ffffff" CLASS="NavBarCell1Rev">
<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#eeeeff" CLASS="NavBarCell1">
<A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN="3"><EM> PIM Optional Package 1.0<br>
Final Release</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/microedition/pim/PIM.html"><B>PREV
CLASS</B></A> NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top">
<B>FRAMES</B></A> <A HREF="RepeatRule.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">javax.microedition.pim</FONT>
<BR>
Class RepeatRule</H2>
<PRE>
java.lang.Object
|
+--<B>javax.microedition.pim.RepeatRule</B>
</PRE>
<HR>
<DL>
<DT>public class <B>RepeatRule</B><DT>extends java.lang.Object</DT></DL>
<P>
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.
</P>
<P>
The fields of a Repeat Rule can conceptually be grouped into two categories:
<ul>
<li>
Frequency of a Repeat Rule
<li>
Fields that modify or refine the Frequency of a Repeat Rule</li>
</ul>
This means that a Repeat Rule's calculation of applicable dates start 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 <code>FREQUENCY</code>, 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 <A HREF="../../../javax/microedition/pim/EventList.html#getSupportedRepeatRuleFields(int)">
<CODE>EventList.getSupportedRepeatRuleFields(int)</CODE></A>
).
<P></P>
<P>
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:</P>
<table BORDER="1">
<TR>
<th>
Fields
</th>
<th>
Set Method
</th>
<th>
Valid Values
</th>
</TR>
<tr>
<td><code>FREQUENCY</code></td>
<td><code>setInt</code></td>
<td><code>DAILY, WEEKLY, MONTHLY, YEARLY</code></td>
</tr>
</table>
<P>
The following table shows the valid values for the fields that modify or refine
the frequency of a RepeatRule:</P>
<table BORDER="1">
<TR>
<th>
Fields
</th>
<th>
Set Method
</th>
<th>
Valid Values
</th>
</TR>
<tr>
<td><code>COUNT</code></td>
<td><code>setInt</code></td>
<td>any positive int</td>
</tr>
<tr>
<td><code>INTERVAL</code></td>
<td><code>setInt</code></td>
<td>any positive int</td>
</tr>
<tr>
<td><code>END</code></td>
<td><code>setDate</code></td>
<td>any valid Date</td>
</tr>
<tr>
<td><code>MONTH_IN_YEAR</code></td>
<td><code>setInt</code></td>
<td><code>JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER,
NOVEMBER, DECEMBER</code> (Note: that these are constants defined in the
RepeatRule class and are not the same as those in the Calendar class)</td>
</tr>
<tr>
<td><code>DAY_IN_WEEK</code></td>
<td><code>setInt</code></td>
<td><CODE>SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY </CODE>(Note:
that these are constants defined in the RepeatRule class and are not the same
as those in the Calendar class)</td>
</tr>
<tr>
<td><code>WEEK_IN_MONTH</code></td>
<td><code>setInt</code></td>
<td><CODE>FIRST, SECOND, THIRD, FOURTH, FIFTH, LAST, SECONDLAST, THIRDLAST, FOURTHLAST,
FIFTHLAST</CODE></td>
</tr>
<tr>
<td><code>DAY_IN_MONTH</code></td>
<td><code>setInt</code></td>
<td>1-31</td>
</tr>
<tr>
<td><code>DAY_IN_YEAR</code></td>
<td><code>setInt</code></td>
<td>1-366</td>
</tr>
</table>
<h3>Examples</h3>
<P>The following examples demonstrate some possible repeat values.</P>
To specify the associated event occurs every day:
<br>
<pre><code>
setInt(RepeatRule.FREQUENCY, RepeatRule.DAILY);</code></pre>
To specify the associated event occurs every day for the next five days:
<br>
<pre><code>
setInt(RepeatRule.FREQUENCY, RepeatRule.DAILY);
setInt(RepeatRule.COUNT, 5);</code></pre>
To specify this event occurs every week on Monday and Tuesday:
<br>
<pre><code>
setInt(RepeatRule.FREQUENCY, RepeatRule.WEEKLY);
setInt(RepeatRule.DAY_IN_WEEK, RepeatRule.MONDAY | RepeatRule.TUESDAY);</code></pre>
To specify the associated event occurs every third week on Friday:
<br>
<pre><code>
setInt(RepeatRule.FREQUENCY, RepeatRule.WEEKLY);
setInt(RepeatRule.INTERVAL, 3);
setInt(RepeatRule.DAY_IN_WEEK, RepeatRule.FRIDAY);</code></pre>
To specify the associated event occurs every month on the Wednesday of the
second week until the end of the current year:
<br>
<pre><code>
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());</code></pre>
To specify the associated event occurs every year on the Sunday of the second
week in May:
<br>
<pre><code>
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);</code></pre>
To specify the associated event occurs every year on the 4th of July:
<br>
<pre><code>
setInt(RepeatRule.FREQUENCY, RepeatRule.YEARLY);
setInt(RepeatRule.MONTH_IN_YEAR, RepeatRule.JULY);
setInt(RepeatRule.DAY_IN_MONTH, 4);</code></pre>
To specify the associated event occurs every year on the first day:
<br>
<pre><code>
setInt(RepeatRule.FREQUENCY, RepeatRule.YEARLY);
setInt(RepeatRule.DAY_IN_YEAR, 1);</code></pre>
To check if a particular Repeat Rule frquency value is supported for events for
a certain event list:<br>
<pre><code>
// 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");
}
</code></pre>
To check if a particular Repeat Rule field is supported for events for a
certain event list:<br>
<pre><code>
// 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;
}
</code></pre>
<P>
<P>
<DL>
<DT><B>Since:</B>
<DD>
PIM 1.0</DD>
</DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#ccccff" CLASS="TableHeadingColor">
<TD COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/pim/RepeatRule.html#APRIL">APRIL</A></B></CODE>
<BR>
Constant for the
month of April used with <code>MONTH_IN_YEAR</code> field.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -