|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.luc.cs.trull.EmptyComponent
edu.luc.cs.trull.TerminatingComponent
edu.luc.cs.trull.AbstractComponent
edu.luc.cs.trull.AbstractCombinator
edu.luc.cs.trull.SingleChildCombinator
edu.luc.cs.trull.AwaitAll
public class AwaitAll
A conjunctive await. A conjunctive await waits until all specified events have occurred, executes an action if present, and continues as the given child component if present. It terminates when the child component terminates. If no events are specified, the combinator waits for any event.
AwaitOne| Nested Class Summary | |
|---|---|
protected class |
AwaitAll.LocalListener
A dedicated listener that forwards outgoing events to all external listeners. |
| Nested classes/interfaces inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
AbstractCombinator.DefaultTerminationListener |
| Field Summary | |
|---|---|
private java.beans.PropertyChangeListener |
action
The action to be invoked as soon as all events have come in. |
private Done |
DONE
An instance of Done to be used in various places. |
private boolean |
hasStartedBody
This flag indicates whether the child has been started. |
private java.beans.PropertyChangeListener |
internalListener
The listener to the child component. |
private static org.apache.log4j.Logger |
logger
|
private java.util.Set |
missingEvents
The set of triggering events still missing. |
private java.util.Set |
startEvents
The set of triggering events for starting this component. |
private TerminationListener |
terminationListener
The child termination listener of this component. |
| Fields inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
components |
| Constructor Summary | |
|---|---|
AwaitAll()
Constructs an empty AwaitAll component that is triggered by any first incoming event. |
|
AwaitAll(java.lang.String[] labels,
Component body)
AwaitAll(labels, null, body). |
|
AwaitAll(java.lang.String[] labels,
java.beans.PropertyChangeListener action)
AwaitAll(labels, action, new Done()) |
|
AwaitAll(java.lang.String[] labels,
java.beans.PropertyChangeListener action,
Component body)
Constructs an AwaitAll component that waits for all the given labels, executes the given action, and then starts the body. |
|
| Method Summary | |
|---|---|
java.beans.PropertyChangeListener |
getAction()
Returns the action for this component to be executed when all triggering events have occurred. |
protected TerminationListener |
getChildTerminationListener()
Returns the internal listener that is notified if the child component terminates. |
protected Component |
getDefaultChild()
This method returns the default child component. |
java.lang.String[] |
getEvents()
Returns the triggering events for this component. |
protected java.beans.PropertyChangeListener |
getInternalListener()
Returns the internal listener that listens to the child component. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method processes incoming events. |
void |
resume()
Resumes this suspendable component. |
void |
setAction(java.beans.PropertyChangeListener action)
Sets the action for this component to be executed when all triggering events have occurred. |
void |
setEvents(java.util.Collection evts)
Sets the triggering events for this component. |
void |
setEvents(java.lang.String[] labels)
Sets the triggering events for this component. |
void |
start(java.beans.PropertyChangeEvent incoming)
Starts this startable component. |
protected void |
startBody(java.beans.PropertyChangeEvent incoming)
|
void |
stop()
Stops this startable component. |
void |
suspend()
Suspends this suspendable component. |
| Methods inherited from class edu.luc.cs.trull.SingleChildCombinator |
|---|
addComponent, getChild, removeComponent |
| Methods inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
addComponent, addComponent, getComponent, getComponentCount, getComponents, removeAllComponents, removeComponent |
| Methods inherited from class edu.luc.cs.trull.AbstractComponent |
|---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getExternalListeners, getPropertyChangeListeners, removePropertyChangeListener |
| Methods inherited from class edu.luc.cs.trull.TerminatingComponent |
|---|
fireTermination, getParent, getTermEvent, scheduleTermination, setTerminationListener |
| Methods inherited from class edu.luc.cs.trull.EmptyComponent |
|---|
getTerminationListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.luc.cs.trull.PropertyChangeSource |
|---|
addPropertyChangeListener, getPropertyChangeListeners, removePropertyChangeListener |
| Methods inherited from interface edu.luc.cs.trull.Terminating |
|---|
getTerminationListener, setTerminationListener |
| Field Detail |
|---|
private java.beans.PropertyChangeListener action
private Done DONE
private boolean hasStartedBody
private java.beans.PropertyChangeListener internalListener
private static final org.apache.log4j.Logger logger
private java.util.Set missingEvents
private java.util.Set startEvents
private TerminationListener terminationListener
| Constructor Detail |
|---|
public AwaitAll()
public AwaitAll(java.lang.String[] labels,
Component body)
AwaitAll(labels, null, body).
public AwaitAll(java.lang.String[] labels,
java.beans.PropertyChangeListener action)
AwaitAll(labels, action, new Done())
public AwaitAll(java.lang.String[] labels,
java.beans.PropertyChangeListener action,
Component body)
labels - an array of event labels to wait for.action - the action to be executed when all specified events have occurred. May be null.body - the component to be started after all specified events have occurred. If null, an empty component is used.| Method Detail |
|---|
public java.beans.PropertyChangeListener getAction()
protected TerminationListener getChildTerminationListener()
AbstractCombinator
getChildTerminationListener in class AbstractCombinatorprotected Component getDefaultChild()
SingleChildCombinator
getDefaultChild in class SingleChildCombinatorpublic java.lang.String[] getEvents()
protected java.beans.PropertyChangeListener getInternalListener()
SingleChildCombinator
getInternalListener in class SingleChildCombinatorpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerpropertyChange in class SingleChildCombinatorevt - the event being received.public void resume()
Suspendable
resume in interface Suspendableresume in class SingleChildCombinatorpublic void setAction(java.beans.PropertyChangeListener action)
action - the action for this component. May be null.public void setEvents(java.util.Collection evts)
evts - a collection of String event labels.public void setEvents(java.lang.String[] labels)
labels - an array of String event labels.public void start(java.beans.PropertyChangeEvent incoming)
Startable
start in interface Startablestart in class SingleChildCombinatorincoming - the event that triggered the invocation of this method. May be null.protected void startBody(java.beans.PropertyChangeEvent incoming)
public void stop()
Startable
stop in interface Startablestop in class SingleChildCombinatorpublic void suspend()
Suspendable
suspend in interface Suspendablesuspend in class SingleChildCombinator
|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||