|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.kernel.util.NamedObj ptolemy.kernel.InstantiableNamedObj ptolemy.kernel.Entity ptolemy.kernel.ComponentEntity ptolemy.actor.AtomicActor ptolemy.actor.TypedAtomicActor ptolemy.backtrack.automatic.ptolemy.actor.lib.BooleanSwitch
public class BooleanSwitch
Split an input stream onto two output ports depending on a boolean control input. In an iteration, if an input token is available at the control input, that token is read, and its value is noted. Its value specifies the output port that should be written to in this and subsequent iterations, until another control input is provided. If no control input is provided, then the inputs are routed to the falseOutput port. In each iteration, at most one token on each channel of the input port is read and sent to the corresponding channel of the trueOutput port or the falseOutput port, depending on the most recently received control input. If the input has width greater than an output port, then some input tokens will be discarded (those on input channels for which there is no corresponding output channel). Because tokens are immutable, the same Token is sent to the output, rather than a copy. The input port may receive Tokens of any type.
Note that the this actor may be used in Synchronous Dataflow (SDF) models, but only under certain circumstances. Specifically, downstream actors will be fired whether a token is sent to them or not. This will only work if the downstream actors specifically check to see whether input tokens are available.
Red (neuendor) |
Green (neuendor) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
private boolean |
_control
|
protected Checkpoint |
$CHECKPOINT
|
private FieldRecord |
$RECORD$_control
|
protected CheckpointRecord |
$RECORD$$CHECKPOINT
|
private FieldRecord[] |
$RECORDS
|
TypedIOPort |
control
Input that selects one of the other input ports. |
TypedIOPort |
falseOutput
Output for tokens on the false path. |
TypedIOPort |
input
The input port. |
TypedIOPort |
trueOutput
Output for tokens on the true path. |
Fields inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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 | |
---|---|
BooleanSwitch(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified name. |
Method Summary | |
---|---|
private boolean |
$ASSIGN$_control(boolean newValue)
|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes made at timestamp and afterward. |
Checkpoint |
$GET$CHECKPOINT()
Get the checkpoint object that monitors this rollbackable object. |
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable object. |
java.lang.Object |
$SET$CHECKPOINT(Checkpoint checkpoint)
Set the checkpoint object of this rollbackable object. |
java.lang.Object |
clone(Workspace workspace)
Clone this actor into the specified workspace. |
void |
fire()
Read a token from each input port. |
void |
initialize()
Initialize this actor so that the falseOutput is written to until a token arrives on the control input. |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
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.InstantiableNamedObj |
---|
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
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.actor.Executable |
---|
isFireFunctional, isStrict, 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 |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
protected transient Checkpoint $CHECKPOINT
public TypedIOPort control
public TypedIOPort input
public TypedIOPort trueOutput
public TypedIOPort falseOutput
private boolean _control
protected transient CheckpointRecord $RECORD$$CHECKPOINT
private transient FieldRecord $RECORD$_control
private transient FieldRecord[] $RECORDS
Constructor Detail |
---|
public BooleanSwitch(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.Method Detail |
---|
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class AtomicActor
workspace
- The workspace for the cloned object.
java.lang.CloneNotSupportedException
- If cloned ports cannot have
as their container the cloned entity (this should not occur), or
if one of the attributes cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor
IllegalActionException
- If there is no director.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor
IllegalActionException
- If the parent class throws it.private final boolean $ASSIGN$_control(boolean newValue)
public void $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Rollbackable
timestamp
- The timestamp.public void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Rollbackable
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
public final Checkpoint $GET$CHECKPOINT()
Rollbackable
$GET$CHECKPOINT
in interface Rollbackable
public final java.lang.Object $SET$CHECKPOINT(Checkpoint checkpoint)
Rollbackable
$SET$CHECKPOINT
in interface Rollbackable
checkpoint
- The new checkpoint object.
Checkpoint.setCheckpoint(Checkpoint)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |