public class BooleanMultiplexor extends TypedAtomicActor
trueInput
and falseInput
ports to the
output port, depending on the value of the select
input.
Upon firing, this actor reads the value at the select
input,
if there is one, and records its value (true or false).
If it has a recorded select value (from this firing or a previous
one), then it reads at most one token from both the
trueInput
and the falseInput
, chooses one
of those tokens depending on the recorded select value,
and produces that token on the output.
Because tokens are immutable, the same Token
is sent to the output, rather than a copy.
This actor is non strict. Specifically, if either
trueInput
or falseInput
is unknown, it may
nonetheless be able to produce an output. Hence, this actor can
be used in domains with fixed-point semantics, such as SR and Continuous.
In dataflow domains (SDF, DDF, and PN), normally all inputs will be known and present when the actor fires. It consumes all inputs and produces one output token. Thus, the actor behaves like an SDF actor, producing and consuming a single token on all ports.
In DE, the actor will only consume those inputs that are available.
It does not even require a new select
input on each firing.
A value provided at the select
input will persist
and will be used in subsequent firings until a new value is provided.
If no value has ever been provided, then this actor will produce no output.
This actor is different from the BooleanSelect
actor, which consumes
one token from the control input in one firing, and
then in the next firing consumes a token from either the
trueInput or the falseInput, depending on the value of the control input.
It is also different from the Select
actor, which consumes
one input from the control input and, in the same firing, one token
from the input channel given by the value of the control input.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
TypedIOPort |
falseInput
Input for tokens on the false path.
|
TypedIOPort |
output
The output port.
|
TypedIOPort |
select
Input that selects one of the other input ports.
|
TypedIOPort |
trueInput
Input for tokens on the true path.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
BooleanMultiplexor(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified
name.
|
Modifier and Type | Method and Description |
---|---|
void |
fire()
Read all inputs that are known, and if the select input
is true, then output the token consumed from the
trueInput port, otherwise output the token from the
falseInput port.
|
void |
initialize()
Initialize this actor to the state where no select
input has been read.
|
boolean |
isStrict()
Return false.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort trueInput
public TypedIOPort falseInput
public TypedIOPort select
public TypedIOPort output
public BooleanMultiplexor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor within the container.IllegalActionException
- If the actor cannot be contained
by the proposed container.NameDuplicationException
- If the name coincides with
an actor already in the container.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If there is no director.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If the superclass throws it.public boolean isStrict()
isStrict
in interface Executable
isStrict
in class AtomicActor<TypedIOPort>