
SetVariable |
ptolemy.actor.lib.SetVariable |
Set the value of a variable contained by the container. The result
may occur at two different times, depending on the value of the
delayed parameter.
If delayed is true, then the change to
the value of the variable is implemented in a change request, and
consequently will not take hold until the end of the current
toplevel iteration. This helps ensure that users of value of the
variable will see changes to the value deterministically
(independent of the schedule of execution of the actors).
If delayed is false, then the change to the value of
the variable is performed immediately. This allows more frequent
reconfiguration, and can mimic the operation of PGM's graph
variables.
Note that the variable name is observed during preinitialize().
If it is changed after that, the change will not take effect
until the next time the model is executed. Moreover, the
type of the variable is constrained in preinitialize()
to be at least that of the input port for this actor.
The variable can be either any attribute that implements
the Settable interface. If it is in addition an instance of
Variable, then the input token is used directly to set the
value, and the type of the variable is constrained to be
the same as the type of the input. Otherwise, then input
token is converted to a string and the setExpression() method
on the variable is used to set the value.
The variable can occur anywhere in the hierarchy above
the current level. If the variable is not found in the container,
then the container of the container is checked until we reach the
top level.
Author(s): Edward A. Lee, Steve Neuendorffer, Contributor: Jérôme Blanc
Version:$Id: SetVariable.java,v 1.37 2006/02/11 17:24:00 cxh Exp $
Pt.Proposed Rating:Red (yuhong)
Pt.Accepted Rating:Red (cxh)
input
The input port.
delayed
Parameter that determines when reconfiguration occurs.