OSDN Git Service

lejos_NXJ_win32_0_5_0beta.zip
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / docs / apidocs / lejos / subsumption / Activity.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.5.0_09) on Tue Jan 08 20:46:01 GMT 2008 -->
6 <TITLE>
7 Activity (leJOS NXT API documentation)
8 </TITLE>
9
10 <META NAME="keywords" CONTENT="lejos.subsumption.Activity class">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17     parent.document.title="Activity (leJOS NXT API documentation)";
18 }
19 </SCRIPT>
20 <NOSCRIPT>
21 </NOSCRIPT>
22
23 </HEAD>
24
25 <BODY BGCOLOR="white" onload="windowTitle();">
26
27
28 <!-- ========= START OF TOP NAVBAR ======= -->
29 <A NAME="navbar_top"><!-- --></A>
30 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32 <TR>
33 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34 <A NAME="navbar_top_firstrow"><!-- --></A>
35 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36   <TR ALIGN="center" VALIGN="top">
37   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44   </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
51
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;PREV CLASS&nbsp;
55 &nbsp;<A HREF="../../lejos/subsumption/ActivityBase.html" title="class in lejos.subsumption"><B>NEXT CLASS</B></A></FONT></TD>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57   <A HREF="../../index.html?lejos/subsumption/Activity.html" target="_top"><B>FRAMES</B></A>  &nbsp;
58 &nbsp;<A HREF="Activity.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60   <!--
61   if(window==top) {
62     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
63   }
64   //-->
65 </SCRIPT>
66 <NOSCRIPT>
67   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
69
70
71 </FONT></TD>
72 </TR>
73 <TR>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_lejos.subsumption.ActivityBase">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78 </TR>
79 </TABLE>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
82
83 <HR>
84 <!-- ======== START OF CLASS DATA ======== -->
85 <H2>
86 <FONT SIZE="-1">
87 lejos.subsumption</FONT>
88 <BR>
89 Class Activity</H2>
90 <PRE>
91 <A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
92   <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../java/lang/Thread.html" title="class in java.lang">java.lang.Thread</A>
93       <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../lejos/subsumption/ActivityBase.html" title="class in lejos.subsumption">lejos.subsumption.ActivityBase</A>
94           <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>lejos.subsumption.Activity</B>
95 </PRE>
96 <HR>
97 <DL>
98 <DT><PRE>public abstract class <B>Activity</B><DT>extends <A HREF="../../lejos/subsumption/ActivityBase.html" title="class in lejos.subsumption">ActivityBase</A></DL>
99 </PRE>
100
101 <P>
102 An activity that operates in coordination with other activities.
103  Only one activity can run at a time.
104  When an activity of a higher priority wants to run any activities
105  of a lower priority will be suppressed. Furthermore, if there is
106  already an activity of the same or lower priority running, that
107  activity will be stopped.
108  <P>
109  This is essentially an alternative  way of implementing a Behavior or
110  Subsumption architecture. It is totally distinct from the Behavior
111  and Arbitrator classes and does not use either.
112  <P>
113  It works like this:
114  <OL>
115  <LI>This class should be sub-classed and the action() method should
116  be implemented to perform the desired action. That may be to respond
117  to a change in a sensor, or it may be to cause the robot to wander
118  around (or anything else).
119  This method should call one of the pause() methods occasionally. In
120  particular if it wants to sleep or yield control it should call pause()
121  instead of sleep() or yield() or wait().
122  <LI>An application should create instances of the sub-classes as needed,
123  set their priorities by calling setPriority() and then start them
124  by calling start().
125  <LI>If an activity wants to run it should call activity.iWantToRun(), or
126  another class could call it.
127  <LI>If there is no higher priority activity
128  running when an activity  become runnable, any activities of the same or
129  lower priority will be suppressed. In addition, if an activity was not
130  already running the action() method will be called in its own thread.
131  <LI>If an activity is already running when it is run again, pause() throws
132  an InterruptedException. It can do what it wants with that. An activity that
133  is run when a sensor is activated might want to restart action() from the
134  beginning for example. A background activity might just ignore it.
135  <LI>If a higher priority activity gets to run, pause() on this activity will
136  throw a StopException. This should not be caught so that the action()
137  method exits with that exception.
138  </OL>
139  Note. A background activity should ensure that something makes it runnable
140  if it is stopped. The easiest way to do that is to override resetRunnable()
141  to call iWantToRun().
142  <P>
143  Example:
144  <pre>
145  &#47;**
146   * When sensor one is pressed, run the motors in some pattern.
147   *&#47;
148  class ControlMotors extends Activity implements PortListener
149  {
150         public ControlMotors()
151         {
152                 Port.S1.addPortListener(this);
153         }
154  
155         &#47;**
156          * Called when the sensor state changes (in some thread other than this one).
157          *&#47; 
158         public void stateChanged(Port s, int old, int nu)
159         {
160                 if (old &gt; nu)
161                         return;
162  
163                 iWantToRun();
164         }
165      
166         &#47;**
167          * Encapsulates the actual activity we want to perform.
168          *
169          * @exception StopException if we are forcibly stopped.
170          *&#47;
171         protected void action() throws StopException
172         {
173                 boolean finished = false;
174                 
175                 &#47;&#47; Sit here until we are finished or we are forcibly halted.                                    
176                 while (!finished)
177                 {
178                         try
179                         {
180                                 &#47;&#47; spin
181                                 Motor.C.forward();
182                                 Motor.A.backward();
183                                 
184                                 &#47;&#47; Wait for 0.25 secs, may throw InterruptedException
185                                 pause(250);
186                                 
187                                 &#47;&#47; Forward
188                                 Motor.A.forward();
189  
190                                 &#47;&#47; We are finished
191                                 finished = true;
192                         } catch (InterruptedException ie)
193                         {
194                                 &#47;&#47; pause() was interrupted. Re-start from the beginning
195                         }
196                 }
197         }
198  }
199  
200  </pre>
201 <P>
202
203 <P>
204 <DL>
205 <DT><B>Author:</B></DT>
206   <DD>Paul Andrews</DD>
207 </DL>
208 <HR>
209
210 <P>
211 <!-- =========== FIELD SUMMARY =========== -->
212
213 <A NAME="field_summary"><!-- --></A>
214 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
215 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
216 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
217 <B>Field Summary</B></FONT></TH>
218 </TR>
219 </TABLE>
220 &nbsp;<A NAME="fields_inherited_from_class_lejos.subsumption.ActivityBase"><!-- --></A>
221 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
222 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
223 <TH ALIGN="left"><B>Fields inherited from class lejos.subsumption.<A HREF="../../lejos/subsumption/ActivityBase.html" title="class in lejos.subsumption">ActivityBase</A></B></TH>
224 </TR>
225 <TR BGCOLOR="white" CLASS="TableRowColor">
226 <TD><CODE><A HREF="../../lejos/subsumption/ActivityBase.html#monitor">monitor</A></CODE></TD>
227 </TR>
228 </TABLE>
229 &nbsp;<A NAME="fields_inherited_from_class_java.lang.Thread"><!-- --></A>
230 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
231 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
232 <TH ALIGN="left"><B>Fields inherited from class java.lang.<A HREF="../../java/lang/Thread.html" title="class in java.lang">Thread</A></B></TH>
233 </TR>
234 <TR BGCOLOR="white" CLASS="TableRowColor">
235 <TD><CODE><A HREF="../../java/lang/Thread.html#MAX_PRIORITY">MAX_PRIORITY</A>, <A HREF="../../java/lang/Thread.html#MIN_PRIORITY">MIN_PRIORITY</A>, <A HREF="../../java/lang/Thread.html#NORM_PRIORITY">NORM_PRIORITY</A></CODE></TD>
236 </TR>
237 </TABLE>
238 &nbsp;
239 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
240
241 <A NAME="constructor_summary"><!-- --></A>
242 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
243 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
244 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
245 <B>Constructor Summary</B></FONT></TH>
246 </TR>
247 <TR BGCOLOR="white" CLASS="TableRowColor">
248 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#Activity()">Activity</A></B>()</CODE>
249
250 <BR>
251 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
252 </TR>
253 </TABLE>
254 &nbsp;
255 <!-- ========== METHOD SUMMARY =========== -->
256
257 <A NAME="method_summary"><!-- --></A>
258 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
259 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
260 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
261 <B>Method Summary</B></FONT></TH>
262 </TR>
263 <TR BGCOLOR="white" CLASS="TableRowColor">
264 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
265 <CODE>protected abstract &nbsp;void</CODE></FONT></TD>
266 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#action()">action</A></B>()</CODE>
267
268 <BR>
269 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encapsulates the actual activity we want to perform.</TD>
270 </TR>
271 <TR BGCOLOR="white" CLASS="TableRowColor">
272 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
273 <CODE>protected &nbsp;void</CODE></FONT></TD>
274 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#iWantToRun()">iWantToRun</A></B>()</CODE>
275
276 <BR>
277 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call this if you want this activity to run.</TD>
278 </TR>
279 <TR BGCOLOR="white" CLASS="TableRowColor">
280 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
281 <CODE>protected &nbsp;void</CODE></FONT></TD>
282 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#pause()">pause</A></B>()</CODE>
283
284 <BR>
285 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait until we've either been made runnable or someone else has.</TD>
286 </TR>
287 <TR BGCOLOR="white" CLASS="TableRowColor">
288 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
289 <CODE>protected &nbsp;void</CODE></FONT></TD>
290 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#pause(long)">pause</A></B>(long&nbsp;time)</CODE>
291
292 <BR>
293 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait at most 'time' milliseconds.</TD>
294 </TR>
295 <TR BGCOLOR="white" CLASS="TableRowColor">
296 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
297 <CODE>protected &nbsp;void</CODE></FONT></TD>
298 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#resetRunnable()">resetRunnable</A></B>()</CODE>
299
300 <BR>
301 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reset the runnable activity.</TD>
302 </TR>
303 <TR BGCOLOR="white" CLASS="TableRowColor">
304 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
305 <CODE>&nbsp;void</CODE></FONT></TD>
306 <TD><CODE><B><A HREF="../../lejos/subsumption/Activity.html#run()">run</A></B>()</CODE>
307
308 <BR>
309 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread entry point.</TD>
310 </TR>
311 </TABLE>
312 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Thread"><!-- --></A>
313 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
314 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
315 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Thread.html" title="class in java.lang">Thread</A></B></TH>
316 </TR>
317 <TR BGCOLOR="white" CLASS="TableRowColor">
318 <TD><CODE><A HREF="../../java/lang/Thread.html#currentThread()">currentThread</A>, <A HREF="../../java/lang/Thread.html#getPriority()">getPriority</A>, <A HREF="../../java/lang/Thread.html#interrupt()">interrupt</A>, <A HREF="../../java/lang/Thread.html#interrupted()">interrupted</A>, <A HREF="../../java/lang/Thread.html#isAlive()">isAlive</A>, <A HREF="../../java/lang/Thread.html#isDaemon()">isDaemon</A>, <A HREF="../../java/lang/Thread.html#isInterrupted()">isInterrupted</A>, <A HREF="../../java/lang/Thread.html#join()">join</A>, <A HREF="../../java/lang/Thread.html#join(long)">join</A>, <A HREF="../../java/lang/Thread.html#setDaemon(boolean)">setDaemon</A>, <A HREF="../../java/lang/Thread.html#setPriority(int)">setPriority</A>, <A HREF="../../java/lang/Thread.html#sleep(long)">sleep</A>, <A HREF="../../java/lang/Thread.html#start()">start</A>, <A HREF="../../java/lang/Thread.html#yield()">yield</A></CODE></TD>
319 </TR>
320 </TABLE>
321 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
322 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
323 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
324 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
325 </TR>
326 <TR BGCOLOR="white" CLASS="TableRowColor">
327 <TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A></CODE></TD>
328 </TR>
329 </TABLE>
330 &nbsp;
331 <P>
332
333 <!-- ========= CONSTRUCTOR DETAIL ======== -->
334
335 <A NAME="constructor_detail"><!-- --></A>
336 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
337 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
338 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
339 <B>Constructor Detail</B></FONT></TH>
340 </TR>
341 </TABLE>
342
343 <A NAME="Activity()"><!-- --></A><H3>
344 Activity</H3>
345 <PRE>
346 public <B>Activity</B>()</PRE>
347 <DL>
348 </DL>
349
350 <!-- ============ METHOD DETAIL ========== -->
351
352 <A NAME="method_detail"><!-- --></A>
353 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
354 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
355 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
356 <B>Method Detail</B></FONT></TH>
357 </TR>
358 </TABLE>
359
360 <A NAME="action()"><!-- --></A><H3>
361 action</H3>
362 <PRE>
363 protected abstract void <B>action</B>()
364                         throws <A HREF="../../lejos/subsumption/StopException.html" title="class in lejos.subsumption">StopException</A></PRE>
365 <DL>
366 <DD>Encapsulates the actual activity we want to perform.
367  Returns when complete or when stopped.
368 <P>
369 <DD><DL>
370
371 <DT><B>Throws:</B>
372 <DD><CODE><A HREF="../../lejos/subsumption/StopException.html" title="class in lejos.subsumption">StopException</A></CODE> - when some other activity has stopped this one.</DL>
373 </DD>
374 </DL>
375 <HR>
376
377 <A NAME="resetRunnable()"><!-- --></A><H3>
378 resetRunnable</H3>
379 <PRE>
380 protected void <B>resetRunnable</B>()</PRE>
381 <DL>
382 <DD>Reset the runnable activity. Normal activities should not
383  override this. Background activities can in order to request that
384  they become runnable.
385 <P>
386 <DD><DL>
387 </DL>
388 </DD>
389 </DL>
390 <HR>
391
392 <A NAME="iWantToRun()"><!-- --></A><H3>
393 iWantToRun</H3>
394 <PRE>
395 protected final void <B>iWantToRun</B>()</PRE>
396 <DL>
397 <DD>Call this if you want this activity to run.
398 <P>
399 <DD><DL>
400 </DL>
401 </DD>
402 </DL>
403 <HR>
404
405 <A NAME="run()"><!-- --></A><H3>
406 run</H3>
407 <PRE>
408 public final void <B>run</B>()</PRE>
409 <DL>
410 <DD>Thread entry point. Never returns.
411 <P>
412 <DD><DL>
413 <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/lang/Thread.html#run()">run</A></CODE> in class <CODE><A HREF="../../java/lang/Thread.html" title="class in java.lang">Thread</A></CODE></DL>
414 </DD>
415 <DD><DL>
416 </DL>
417 </DD>
418 </DL>
419 <HR>
420
421 <A NAME="pause(long)"><!-- --></A><H3>
422 pause</H3>
423 <PRE>
424 protected final void <B>pause</B>(long&nbsp;time)
425                     throws <A HREF="../../java/lang/InterruptedException.html" title="class in java.lang">InterruptedException</A>,
426                            <A HREF="../../lejos/subsumption/StopException.html" title="class in lejos.subsumption">StopException</A></PRE>
427 <DL>
428 <DD>Wait at most 'time' milliseconds. Returning
429  without an exception means continue the activity where it left off.
430 <P>
431 <DD><DL>
432
433 <DT><B>Throws:</B>
434 <DD><CODE><A HREF="../../java/lang/InterruptedException.html" title="class in java.lang">InterruptedException</A></CODE> - if we were made runnable whilst
435  we were running. This might indicate, for example, that a sensor
436  was pressed while we were still reacting to an earlier press.
437  Typically, an activity would want to restart execution of the
438  action() method from the beginning if that happened.
439 <DD><CODE><A HREF="../../lejos/subsumption/StopException.html" title="class in lejos.subsumption">StopException</A></CODE> - if we should stop executing altogether.</DL>
440 </DD>
441 </DL>
442 <HR>
443
444 <A NAME="pause()"><!-- --></A><H3>
445 pause</H3>
446 <PRE>
447 protected final void <B>pause</B>()
448                     throws <A HREF="../../java/lang/InterruptedException.html" title="class in java.lang">InterruptedException</A>,
449                            <A HREF="../../lejos/subsumption/StopException.html" title="class in lejos.subsumption">StopException</A></PRE>
450 <DL>
451 <DD>Wait until we've either been made runnable or someone else has.
452 <P>
453 <DD><DL>
454
455 <DT><B>Throws:</B>
456 <DD><CODE><A HREF="../../java/lang/InterruptedException.html" title="class in java.lang">InterruptedException</A></CODE> - if we should restart execution of the
457  action() method from the beginning.
458 <DD><CODE><A HREF="../../lejos/subsumption/StopException.html" title="class in lejos.subsumption">StopException</A></CODE> - if we should stop executing altogether.</DL>
459 </DD>
460 </DL>
461 <!-- ========= END OF CLASS DATA ========= -->
462 <HR>
463
464
465 <!-- ======= START OF BOTTOM NAVBAR ====== -->
466 <A NAME="navbar_bottom"><!-- --></A>
467 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
468 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
469 <TR>
470 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
471 <A NAME="navbar_bottom_firstrow"><!-- --></A>
472 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
473   <TR ALIGN="center" VALIGN="top">
474   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
475   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
476   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
477   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
478   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
479   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
480   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
481   </TR>
482 </TABLE>
483 </TD>
484 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
485 </EM>
486 </TD>
487 </TR>
488
489 <TR>
490 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
491 &nbsp;PREV CLASS&nbsp;
492 &nbsp;<A HREF="../../lejos/subsumption/ActivityBase.html" title="class in lejos.subsumption"><B>NEXT CLASS</B></A></FONT></TD>
493 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
494   <A HREF="../../index.html?lejos/subsumption/Activity.html" target="_top"><B>FRAMES</B></A>  &nbsp;
495 &nbsp;<A HREF="Activity.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
496 &nbsp;<SCRIPT type="text/javascript">
497   <!--
498   if(window==top) {
499     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
500   }
501   //-->
502 </SCRIPT>
503 <NOSCRIPT>
504   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
505 </NOSCRIPT>
506
507
508 </FONT></TD>
509 </TR>
510 <TR>
511 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
512   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_lejos.subsumption.ActivityBase">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
513 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
514 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
515 </TR>
516 </TABLE>
517 <A NAME="skip-navbar_bottom"></A>
518 <!-- ======== END OF BOTTOM NAVBAR ======= -->
519
520 <HR>
521
522 </BODY>
523 </HTML>