|
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.Sequence
public class Sequence
A combinator for executing zero or more components in sequence. The components that form part of the sequence should indicate termination. A sequence terminates when its last component terminates.
| Nested Class Summary | |
|---|---|
protected class |
Sequence.ForwardListener
A dedicated listener that forwards the event to all external listeners. |
protected class |
Sequence.SequenceTerminationListener
A termination listener that, when the current component terminates, starts the next component in the sequence. |
| Nested classes/interfaces inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
AbstractCombinator.DefaultTerminationListener |
| Field Summary | |
|---|---|
private int |
currentComponentIndex
The index of the currently active component. |
private Done |
DONE
An instance of Done used as the default child. |
private java.beans.PropertyChangeListener |
internalListener
An internal listener that listens to the currently active child branch of this component and forwards events to the external listeners. |
private static org.apache.log4j.Logger |
logger
|
private TerminationListener |
terminationListener
The child termination listener of this component. |
| Fields inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
components |
| Constructor Summary | |
|---|---|
Sequence()
Constructs a Sequence component. |
|
Sequence(Component[] components)
Constructs a Sequence component consisting of the given list of components. |
|
Sequence(Component first,
Component second)
Constructs a Sequence component consisting of the two given components in order. |
|
| Method Summary | |
|---|---|
protected void |
connectComponent(Component c)
Hooks up the given component for communication and termination. |
protected void |
disconnectComponent(Component c)
Unhooks the given component from communication and termination. |
protected TerminationListener |
getChildTerminationListener()
Returns the internal listener that is notified if the child component terminates. |
protected Component |
getCurrentComponent()
Returns the currently active component. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method forwards events received from external sources to the components of this composite. |
void |
removeComponent(Component c)
Removes the specified component from this combinator. |
void |
resume()
Resumes this suspendable component. |
void |
start(java.beans.PropertyChangeEvent incoming)
Starts this startable component. |
void |
stop()
Stops this startable component. |
void |
suspend()
Suspends this suspendable component. |
protected void |
switchToFirstComponent()
Switches to the first component in the sequence. |
protected void |
switchToNextComponent()
Switches to the next component in the sequence. |
| Methods inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
addComponent, 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 int currentComponentIndex
private final Done DONE
private java.beans.PropertyChangeListener internalListener
private static final org.apache.log4j.Logger logger
private TerminationListener terminationListener
| Constructor Detail |
|---|
public Sequence()
public Sequence(Component[] components)
components - the list of components in the sequence.
public Sequence(Component first,
Component second)
first - the first component in the sequence.second - the second component in the sequence.| Method Detail |
|---|
protected void connectComponent(Component c)
c - the component to be hooked up.protected void disconnectComponent(Component c)
c - the component to be unhooked.protected TerminationListener getChildTerminationListener()
AbstractCombinator
getChildTerminationListener in class AbstractCombinatorprotected Component getCurrentComponent()
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerpropertyChange in class EmptyComponentevt - the event received.public void removeComponent(Component c)
AbstractCombinator
removeComponent in interface CombinatorremoveComponent in class AbstractCombinatorc - the component to be removed.public void resume()
Suspendable
resume in interface Suspendableresume in class EmptyComponentpublic void start(java.beans.PropertyChangeEvent incoming)
Startable
start in interface Startablestart in class EmptyComponentincoming - the event that triggered the invocation of this method. May be null.public void stop()
Startable
stop in interface Startablestop in class EmptyComponentpublic void suspend()
Suspendable
suspend in interface Suspendablesuspend in class EmptyComponentprotected void switchToFirstComponent()
protected void switchToNextComponent()
|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||