ptolemy.actor.parameters
Class DoubleRangeParameter
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.AbstractSettableAttribute
ptolemy.data.expr.Variable
ptolemy.data.expr.Parameter
ptolemy.actor.parameters.DoubleRangeParameter
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, ValueListener
public class DoubleRangeParameter
- extends Parameter
This is a parameter with type double with a limited range and
limited precision.
Its value is an double token that is constrained to lie
within the boundaries specified by its two parameters,
min and max, inclusive. Moreover, the values
are quantized so that there are exactly precision
values, uniformly spaced in the range.
A user interface will typically use this
information to represent the parameter value using a slider.
The default values for min and max are 0.0 and 1.0,
with a default value of 0.5. The default precision is 100.
- Since:
- Ptolemy II 4.1
- Version:
- $Id: DoubleRangeParameter.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Field Summary |
private boolean |
_inCheck
Indicator that we are in the middle of a check, so skip
circular dependency. |
Parameter |
max
The maximum value. |
Parameter |
min
The minimum value. |
Parameter |
precision
The precision, which is the number of possible values. |
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary |
DoubleRangeParameter(NamedObj container,
java.lang.String name)
Construct an attribute with the given name contained by the
specified container. |
Method Summary |
protected void |
_setTokenAndNotify(Token newToken)
Set the token value and type of the variable, and notify the
container that the value (and type, if appropriate) has changed. |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute by ensuring that the current
value remains within the range given by min and max. |
Methods inherited from class ptolemy.data.expr.Variable |
_description, _evaluate, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, addValueListener, clone, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isTypeAcceptable, removeValueListener, reset, setContainer, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, validate, valueChanged |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
max
public Parameter max
- The maximum value. This is has a double value, and defaults to 1.0.
min
public Parameter min
- The minimum value. This is has a double value, and defaults to 0.0.
precision
public Parameter precision
- The precision, which is the number of possible values.
This is has an integer value, and defaults to 100.
_inCheck
private boolean _inCheck
- Indicator that we are in the middle of a check, so skip
circular dependency.
DoubleRangeParameter
public DoubleRangeParameter(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct an attribute with the given name contained by the
specified container. The container argument must not be null, or a
NullPointerException will be thrown. This attribute will use the
workspace of the container for synchronization and version counts.
If the name argument is null, then the name is set to the empty
string. Increment the version of the workspace.
- Parameters:
container
- The container.name
- The name of this attribute.
- Throws:
IllegalActionException
- If the attribute is not of an
acceptable class for the container, or if the name contains a period.
NameDuplicationException
- If the name coincides with
an attribute already in the container.
attributeChanged
public void attributeChanged(Attribute attribute)
throws IllegalActionException
- React to a change in an attribute by ensuring that the current
value remains within the range given by min and max.
- Overrides:
attributeChanged
in class NamedObj
- Parameters:
attribute
- The attribute that changed.
- Throws:
IllegalActionException
- If the change is not acceptable
to this container (should not be thrown).
_setTokenAndNotify
protected void _setTokenAndNotify(Token newToken)
throws IllegalActionException
- Description copied from class:
Variable
- Set the token value and type of the variable, and notify the
container that the value (and type, if appropriate) has changed.
Also notify value dependents that they need to be re-evaluated,
and notify any listeners that have been registered with
addValueListener().
If setTypeEquals() has been called, then attempt to convert
the specified token into one of the appropriate type, if needed,
rather than changing the type.
- Overrides:
_setTokenAndNotify
in class Variable
- Parameters:
newToken
- The new value of the variable.
- Throws:
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.