public class IntRangeParameter extends Parameter
This is a parameter with type integer with a limited range. Its value is an integer token that is constrained to lie within the boundaries specified by its two parameters, min and max. These specify the minimum and maximum values. A user interface will typically use this information to represent the parameter value using a slider which can be decorated by labels indicating the minimum and maximum values. The actual text displayed by the labels can be set using the minLabel and maxLabel parameters which default to showing the actual minimum and maximum int value. The default values for min and max are 0 and 100, respectively, and the default value for this parameter is 50.
Red (cxh) |
Yellow (eal) |
Variable.CircularDependencyError, Variable.VariableScope
NamedObj.ContainedObjectsIterator
Settable.Visibility
Modifier and Type | Field and Description |
---|---|
Parameter |
max
The maximum value.
|
StringParameter |
maxLabel
The label text displayed for the maximum end of the slider.
|
Parameter |
min
The minimum value.
|
StringParameter |
minLabel
The label text displayed for the minimum end of the slider.
|
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _valueListeners
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
EXPERT, FULL, NONE, NOT_EDITABLE
Constructor and Description |
---|
IntRangeParameter(NamedObj container,
java.lang.String name)
Construct an attribute with the given name contained by the
specified container.
|
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getCurrentValue()
Return the current value of this parameter as an integer.
|
int |
getMaxValue()
Return the maximum value of this parameter as an integer.
|
int |
getMinValue()
Return the minimum value of this parameter.
|
addChoice, clone, exportMoML, getChoices, removeAllChoices, removeChoice
_description, _evaluate, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, addValueListener, 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
getDefaultExpression
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDisplayName
description, getContainer, getFullName, getName, getName
public Parameter max
public Parameter min
public StringParameter maxLabel
$max
, which is expanded to the value of the max
parameter in the user interface.public StringParameter minLabel
$min
, which is expanded to the value of the min
parameter in the user interface.public IntRangeParameter(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this attribute.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.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the change is not acceptable
to this container (should not be thrown).public int getCurrentValue() throws IllegalActionException
IllegalActionException
- If the expression cannot
be parsed or cannot be evaluated, or if the result of evaluation
violates type constraints, or if the result of evaluation is null
and there are variables that depend on this one.public int getMaxValue() throws IllegalActionException
IllegalActionException
- If the expression cannot
be parsed or cannot be evaluated, or if the result of evaluation
violates type constraints, or if the result of evaluation is null
and there are variables that depend on this one.public int getMinValue() throws IllegalActionException
IllegalActionException
- If the expression cannot
be parsed or cannot be evaluated, or if the result of evaluation
violates type constraints, or if the result of evaluation is null
and there are variables that depend on this one.protected void _setTokenAndNotify(Token newToken) throws IllegalActionException
Variable
_setTokenAndNotify
in class Variable
newToken
- The new value of the 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.