ptolemy.domains.csp.lib
Class Barrier
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.csp.lib.Barrier
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, BranchActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class Barrier
- extends TypedAtomicActor
- implements BranchActor
This actor implements multiway rendezvous on all channels
of the input port, collects the tokens, and then performs
a multiway rendezvous on all channels of the output port,
sending the collected data. A token provided on an
input channel is sent to the corresponding output channel.
If there are fewer output channels than input channels, then
the corresponding input data are discarded.
If there are fewer input channels than output channels,
then the last input channel provides the token for the
remaining ones. If there are no input channels,
then an exception is thrown.
- Since:
- Ptolemy II 5.2
- Version:
- $Id: Barrier.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary |
Barrier(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified
name. |
Method Summary |
void |
fire()
Perform a multiway rendezvous with all input channels, collect
one input token from each channel, and then perform a multiway
rendezvous with the output channels, providing that data. |
AbstractBranchController |
getBranchController()
Return the conditional branch control of this actor. |
void |
initialize()
Initialize this actor. |
boolean |
postfire()
Return true unless one of the branches was terminated
during the execution of the fire() method. |
Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup |
Methods inherited from class ptolemy.kernel.ComponentEntity |
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
input
public TypedIOPort input
- The input port, which is a multiport that can accept any data type.
output
public TypedIOPort output
- The output port, which is a multiport whose type is at least that
of the input port.
_branchController
private MultiwayBranchController _branchController
- The controller for multiway branches.
_terminate
private boolean _terminate
- Flag indicating whether a branch was terminated during fire().
_listeningToBranchController
private boolean _listeningToBranchController
- Boolean flag indicating that we are already listening to the branch controller.
_VERBOSE_DEBUGGING
private static boolean _VERBOSE_DEBUGGING
- Flag to set verbose debugging messages.
Barrier
public Barrier(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct an actor in the specified container with the specified
name. The name must be unique within the container or an exception
is thrown. The container argument must not be null, or a
NullPointerException will be thrown.
- Parameters:
container
- The container.name
- The name.
- Throws:
IllegalActionException
- If the actor cannot be contained
by the proposed container.
NameDuplicationException
- If the name coincides with
an actor already in the container.
fire
public void fire()
throws IllegalActionException
- Perform a multiway rendezvous with all input channels, collect
one input token from each channel, and then perform a multiway
rendezvous with the output channels, providing that data.
- Specified by:
fire
in interface Executable
- Overrides:
fire
in class AtomicActor
- Throws:
IllegalActionException
- If the input width is zero.
TerminateProcessException
- If the process termination
is requested by the director.
getBranchController
public AbstractBranchController getBranchController()
- Return the conditional branch control of this actor.
- Specified by:
getBranchController
in interface BranchActor
- Returns:
- The conditional branch controller.
initialize
public void initialize()
throws IllegalActionException
- Initialize this actor.
- Specified by:
initialize
in interface Initializable
- Overrides:
initialize
in class AtomicActor
- Throws:
IllegalActionException
- If a derived class throws it.
postfire
public boolean postfire()
- Return true unless one of the branches was terminated
during the execution of the fire() method.
- Specified by:
postfire
in interface Executable
- Overrides:
postfire
in class AtomicActor
- Returns:
- True if another iteration can occur.