Class BooleanMultiplexor
- 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.actor.lib.BooleanMultiplexor
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class BooleanMultiplexor extends TypedAtomicActor
A multiplexor with a boolean-valued select control signal. This actor conditionally routes input values from thetrueInput
andfalseInput
ports to the output port, depending on the value of theselect
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 thetrueInput
and thefalseInput
, 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
orfalseInput
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 theselect
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 theSelect
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.- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Steve Neuendorffer, Stavros Tripakis, Edward A. Lee
- Pt.AcceptedRating:
- Yellow (neuendor)
- Pt.ProposedRating:
- Green (neuendor)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field 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.-
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 BooleanMultiplexor(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()
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.-
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, iterate, newReceiver, outputPortList, postfire, 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, iterate, postfire, 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
-
trueInput
public TypedIOPort trueInput
Input for tokens on the true path. The type can be anything.
-
falseInput
public TypedIOPort falseInput
Input for tokens on the false path. The type can be anything.
-
select
public TypedIOPort select
Input that selects one of the other input ports. The type is boolean.
-
output
public TypedIOPort output
The output port. The type is at least the type of trueInput and falseInput
-
-
Constructor Detail
-
BooleanMultiplexor
public BooleanMultiplexor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an actor in the specified container with the specified name.- Parameters:
container
- The container.name
- The name of this actor within the container.- 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
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. If the required input is unknown, then the output will remain unknown.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If there is no director.
-
initialize
public void initialize() throws IllegalActionException
Initialize this actor to the state where no select input has been read.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If the superclass throws it.
-
isStrict
public boolean isStrict()
Return false.- Specified by:
isStrict
in interfaceExecutable
- Overrides:
isStrict
in classAtomicActor<TypedIOPort>
- Returns:
- False.
-
-