Package ptolemy.domains.csp.lib
Class Barrier
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.domains.csp.lib.Barrier
-
- All Implemented Interfaces:
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$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description TypedIOPort
input
The input port, which is a multiport that can accept any data type.TypedIOPort
output
The output port, which is a multiport whose type is at least that of the input port.-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description Barrier(CompositeEntity container, java.lang.String name)
Construct an actor in the specified container with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, 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
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, 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, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, 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
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
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.
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
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 interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- 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 interfaceBranchActor
- Returns:
- The conditional branch controller.
-
initialize
public void initialize() throws IllegalActionException
Initialize this actor.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAtomicActor<TypedIOPort>
- 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 interfaceExecutable
- Overrides:
postfire
in classAtomicActor<TypedIOPort>
- Returns:
- True if another iteration can occur.
-
-