|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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
public class Parameter
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().
PtParser
,
Token
,
Serialized Form
Red (cxh) |
Yellow (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable |
---|
Variable.VariableScope |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable |
---|
Settable.Visibility |
Field Summary | |
---|---|
private java.util.List |
_choices
|
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, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.kernel.util.Settable |
---|
EXPERT, FULL, NONE, NOT_EDITABLE |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
addChoice(java.lang.String choice)
Add a choice. |
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. |
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute |
---|
getDefaultExpression |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.kernel.util.Settable |
---|
getDisplayName |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getFullName, getName, getName |
Field Detail |
---|
private java.util.List _choices
Constructor Detail |
---|
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.Method Detail |
---|
public void addChoice(java.lang.String choice)
choice
- A choice to offer to the user.removeChoice(String)
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |