|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.AbstractSettableAttribute
ptolemy.data.expr.Variable
ptolemy.data.expr.Parameter
ptolemy.actor.parameters.PortParameter
This parameter creates an associated port that can be used to update the current value of the parameter. This parameter has two values, which may not be equal, a current value and a persistent value. The persistent value is returned by getExpression() and is set by any of three different mechanisms:
When using this parameter in an actor, care must be exercised to call update() exactly once per firing prior to calling getToken(). Each time update() is called, a new token will be consumed from the associated port (if the port is connected and has a token). If this is called multiple times in an iteration, it may result in consuming tokens that were intended for subsequent iterations. Thus, for example, update() should not be called in fire() and then again in postfire(). Moreover, in some domains (such as DE), it is essential that if a token is provided on a port, that it is consumed. In DE, the actor will be repeatedly fired until the token is consumed. Thus, it is an error to not call update() once per iteration. For an example of an actor that uses this mechanism, see Ramp.
If this actor is placed in a container that does not implement the TypedActor interface, then no associated port is created, and it functions as an ordinary parameter. This is useful, for example, if this is put in a library, where one would not want the associated port to appear.
Ramp,
ParameterPort,
Serialized Form
| Yellow (neuendor) |
| Green (eal) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.data.expr.Variable |
Variable.VariableScope |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
NamedObj.ContainedObjectsIterator |
| Nested classes inherited from class ptolemy.kernel.util.Settable |
Settable.Visibility |
| Field Summary | |
protected ParameterPort |
_port
The associated port. |
| Fields inherited from class ptolemy.data.expr.Variable |
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _valueListeners |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Fields inherited from interface ptolemy.kernel.util.Settable |
EXPERT, FULL, NONE, NOT_EDITABLE |
| Constructor Summary | |
PortParameter(NamedObj container,
java.lang.String name)
Construct a parameter with the given name contained by the specified entity. |
|
PortParameter(NamedObj container,
java.lang.String name,
Token token)
Construct a Parameter with the given container, name, and Token. |
|
| Method Summary | |
protected void |
_checkContainer(Entity container)
Check that the specified container is of a suitable class for this parameter. |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute. |
java.lang.Object |
clone(Workspace workspace)
Clone the parameter. |
ParameterPort |
getPort()
Return the associated port. |
void |
setContainer(Entity entity)
Set the container of this parameter. |
void |
setCurrentValue(Token token)
Set the current value of this parameter and notify the container and value listeners. |
void |
setName(java.lang.String name)
Set or change the name, and propagate the name change to the associated port. |
void |
update()
Check to see whether a token has arrived at the associated port, and if so, update the current value of parameter with that token. |
| Methods inherited from class ptolemy.data.expr.Parameter |
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice |
| Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute |
getDefaultExpression |
| Methods inherited from class ptolemy.kernel.util.Attribute |
_getContainedObject, _propagateExistence, getContainer |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ptolemy.kernel.util.Nameable |
description, getContainer, getFullName, getName, getName |
| Field Detail |
protected ParameterPort _port
| Constructor Detail |
public PortParameter(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container.name - The name of the parameter.
IllegalActionException - If the parameter is not of an
acceptable class for the container.
NameDuplicationException - If the name coincides with
a parameter already in the container.
public PortParameter(NamedObj container,
java.lang.String name,
Token token)
throws IllegalActionException,
NameDuplicationException
container - The container.name - The name.token - The Token contained by this Parameter.
IllegalActionException - If the parameter is not of an
acceptable class for the container.
NameDuplicationException - If the name coincides with
an parameter already in the container.| Method Detail |
public void attributeChanged(Attribute attribute)
throws IllegalActionException
attributeChanged in class NamedObjattribute - The attribute that changed.
IllegalActionException - If the change is not acceptable
to this container (not thrown in this base class).public ParameterPort getPort()
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
clone in class Variableworkspace - The workspace in which to place the cloned parameter.
java.lang.CloneNotSupportedException - Not thrown in this base class.Object.clone()
public void setContainer(Entity entity)
throws IllegalActionException,
NameDuplicationException
entity - The new container.
IllegalActionException - If the superclass throws it.
NameDuplicationException - If the superclass throws it.ParameterPort
public void setCurrentValue(Token token)
throws IllegalActionException
If the type of this variable has been set with setTypeEquals(), then convert the specified token into that type, if possible, or throw an exception, if not. If setTypeAtMost() has been called, then verify that its type constraint is satisfied, and if not, throw an exception. Note that you can call this with a null argument regardless of type constraints, unless there are other variables that depend on its value.
token - The new token to be stored in this variable.
IllegalActionException - If the token type is not
compatible with specified constraints, or if you are attempting
to set to null a variable that has value dependents, or if the
container rejects the change.
public void setName(java.lang.String name)
throws IllegalActionException,
NameDuplicationException
setName in interface NameablesetName in class Attributename - The new name.
IllegalActionException - If the name contains a period.
NameDuplicationException - If the container already
contains an attribute with the proposed name.
public void update()
throws IllegalActionException
IllegalActionException - If reading from the associated
port throws it.
protected void _checkContainer(Entity container)
throws IllegalActionException
container - The proposed container.
IllegalActionException - If the container is not an
instance of Entity.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||