public class Parameter extends Variable
Parameter extends Variable with additional support for string-valued variables that makes these friendlier at the user interface level. In particular, this class supports an annotation that specifies choices for values. A user interface can use this to present a choice dialog that offers the specified values. This is typically used when a particular set of choices make sense. The values can be any expression, or if used in conjunction with string mode, any string.
By default, an instance of Parameter, unlike Variable, is persistent.
By convention, an instance of NamedObj has a set of attributes, some of which are visible to users and some of which are not. When a user interface presents these attributes for editing, it presents only those that are visible. By default, an instance of Parameter is visible, as indicated by the fact that it returns FULL in its getVisibility() method. This can be overridden by calling setVisibility().
Variable.CircularDependencyError, Variable.VariableScope
NamedObj.ContainedObjectsIterator
Settable.Visibility
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _suppressVariableSubstitution, _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 |
---|
Parameter()
Construct a parameter in the default workspace with an empty
string as its name.
|
Parameter(NamedObj container,
java.lang.String name)
Construct a parameter with the given name contained by the specified
entity.
|
Parameter(NamedObj container,
java.lang.String name,
Token token)
Construct a Parameter with the given container, name, and Token.
|
Parameter(Workspace workspace)
Construct a parameter in the specified workspace with an empty
string as a name.
|
Modifier and Type | Method and Description |
---|---|
void |
addChoice(java.lang.String choice)
Add a choice.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
void |
exportMoML(java.io.Writer output,
int depth,
java.lang.String name)
Write a MoML description of this object, unless this object is
not persistent.
|
java.lang.String[] |
getChoices()
Get choices.
|
void |
removeAllChoices()
Remove all the choices.
|
void |
removeChoice(java.lang.String choice)
Remove a choice.
|
_description, _evaluate, _getCurrentExpression, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, attributeChanged, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isSuppressVariableSubstitution, isTypeAcceptable, removeValueListener, reset, setContainer, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setSuppressVariableSubstitution, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setValueListenerAsWeakDependency, 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()
public Parameter(Workspace workspace)
workspace
- The workspace that will list the parameter.public Parameter(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 Parameter(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.public void addChoice(java.lang.String choice)
choice
- A choice to offer to the user.removeChoice(String)
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
public void exportMoML(java.io.Writer output, int depth, java.lang.String name) throws java.io.IOException
exportMoML
in interface MoMLExportable
exportMoML
in class NamedObj
output
- The output stream to write to.depth
- The depth in the hierarchy, to determine indenting.name
- The name to use instead of the current name.java.io.IOException
- If an I/O error occurs.NamedObj.isPersistent()
public java.lang.String[] getChoices()
addChoice(String)
public void removeAllChoices()
removeChoice(String)
public void removeChoice(java.lang.String choice)
choice
- A choice to remove from the list offered to the user.addChoice(String)
,
removeAllChoices()