|
Triveni | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--triveni.Communicator
|
+--triveni.Activity
An Activity is a software component that combines
three aspects of behavior:
Act expression.
They are controlled (started, stopped, suspended, resumed) by the
surrounding system.
All three aspects of behavior may result in the emission of
events to the surrounding system (the activities' environment).
However, care must be taken to avoid deadlock when emitting
an event in response to an incoming event. The response event
must be emitted in a separate thread. See also the
setUpdateHandler method.
Subclasses override the methods onStart,
onStop, onSuspend, and onResume
as needed. Subclasses should also override
clone if they have their own reference instance variables.
Subclasses may handle incoming events either manually by overriding
update, or preferably by using the method
setUpdateHandler to specify a Triveni expression
for this purpose. If incoming events are handled manually,
the activity must use setRelevantLabels to specify
which incoming events it is interested in.
LabeledEvent,
Expr,
Act,
ThreadActivity| Constructor Summary | |
Activity()
|
|
| Method Summary | |
protected void |
clearQuiescent()
Invoked by subclasses to indicate that a new round of event processing is about to start. |
java.lang.Object |
clone()
|
void |
emitEvent(LabeledEvent evt)
|
void |
emitEvent(java.lang.Object label)
emitEvent(new LabeledEvent(label, null)) |
void |
emitEvent(java.lang.Object label,
java.lang.Object evt)
emitEvent(new LabeledEvent(label, evt, this)) |
void |
emitInterruptibly(LabeledEvent evt)
Causes this activity to emit a labeled event to the environment. |
void |
emitInterruptibly(java.lang.Object label)
emitInterruptibly(new LabeledEvent(label, null)) |
void |
emitInterruptibly(java.lang.Object label,
java.lang.Object evt)
emitInterruptibly(new LabeledEvent(label, evt, this)) |
boolean |
isQuiescent()
Whether this activity is currently quiescent. |
boolean |
isStopped()
Whether this activity is currently stopped. |
boolean |
isSuspended()
Whether this activity is currently suspended. |
protected void |
onEmit()
Subclasses should put here any code to be executed when the activity emits an event. |
protected void |
onResume()
Subclasses should put here any code to be executed when the activity is resumed. |
protected void |
onStart()
Subclasses should put here any code to be executed when the activity is started. |
protected void |
onStop()
Subclasses should put here any code to be executed when the activity is stopped. |
protected void |
onSuspend()
Subclasses should put here any code to be executed when the activity is suspended. |
protected void |
setQuiescent()
Invoked by subclasses to indicate that the current round of event processing has terminated and the activity has quiesced. |
protected void |
setUpdateHandler(Expr updateHandler)
This method is used to provide the activity with a Triveni expression that handles incoming events. |
void |
update(LabeledEvent evt)
Handles incoming events. |
| Methods inherited from class triveni.Communicator |
addLabeledListener,
addRelevantLabel,
addRelevantLabels,
fireEvent,
getRelevantLabels,
removeLabeledListener,
removeRelevantLabel,
setRelevantLabels,
setRelevantLabels |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public Activity()
| Method Detail |
protected final void setUpdateHandler(Expr updateHandler)
emitEvent
in a separate thread, for example, using the method
javax.swing.SwingUtilities.invokeLater.updateHandler - the Triveni expression that handles incoming events.protected final void setQuiescent()
protected final void clearQuiescent()
public void update(LabeledEvent evt)
throws java.lang.InterruptedException
setUpdateHandler method.
This method must not emit response events directly to avoid
deadlock; instead, a separate thread should be used.setUpdateHandler(Expr)protected void onStart()
protected void onStop()
protected void onSuspend()
protected void onResume()
protected void onEmit()
public final boolean isStopped()
public final boolean isSuspended()
public boolean isQuiescent()
public final void emitInterruptibly(LabeledEvent evt)
throws java.lang.InterruptedException
public final void emitInterruptibly(java.lang.Object label,
java.lang.Object evt)
throws java.lang.InterruptedException
emitInterruptibly(new LabeledEvent(label, evt, this))
public final void emitInterruptibly(java.lang.Object label)
throws java.lang.InterruptedException
emitInterruptibly(new LabeledEvent(label, null))
public final void emitEvent(LabeledEvent evt)
public final void emitEvent(java.lang.Object label,
java.lang.Object evt)
emitEvent(new LabeledEvent(label, evt, this))
public final void emitEvent(java.lang.Object label)
emitEvent(new LabeledEvent(label, null))
public java.lang.Object clone()
|
Triveni | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||