Package ptolemy.actor.parameters.test
Class TestSharedParameter
- 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.SharedParameter
-
- ptolemy.actor.parameters.test.TestSharedParameter
-
- All Implemented Interfaces:
java.lang.Cloneable,Initializable,HasTypeConstraints,Typeable,Changeable,Debuggable,DebugListener,Derivable,ModelErrorHandler,MoMLExportable,Moveable,Nameable,Settable,ValueListener
public class TestSharedParameter extends SharedParameter
A test suite parameter that is shared globally in a model.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Christopher Brooks
- Pt.AcceptedRating:
- Green (acataldo)
- Pt.ProposedRating:
- Green (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable
Variable.CircularDependencyError, 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
Fields Modifier and Type Field Description intinferValueFromContextCountintisSuppressingPropagationCountintpropagateValueCountintsetExpressionCountintsharedParameterSetCountintvalidateCount-
Fields inherited from class ptolemy.data.expr.Variable
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _suppressVariableSubstitution, _valueListeners
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description TestSharedParameter(NamedObj container, java.lang.String name)Construct a parameter with the given container and name.TestSharedParameter(NamedObj container, java.lang.String name, java.lang.Class containerClass)Construct a parameter with the given container, name, and container class.TestSharedParameter(NamedObj container, java.lang.String name, java.lang.Class containerClass, java.lang.String defaultValue)Construct a parameter with the given container, name, container class, and default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_propagateValue(NamedObj destination)Override the base class to do the propagation only if the specified destination is not shared.java.lang.StringgetCounts()Return the current counts.voidinferValueFromContext(java.lang.String defaultValue)Infer the value of this parameter from the container context.booleanisSuppressingPropagation()Return true if this instance is suppressing propagation.voidsetExpression(java.lang.String expression)Override the base class to also set the expression of shared parameters.java.util.CollectionsharedParameterSet()Return a collection of all the shared parameters within the same model as this parameter.java.util.Collectionvalidate()Override the base class to also validate the shared instances.-
Methods inherited from class ptolemy.actor.parameters.SharedParameter
addInitializable, clone, getRoot, getToken, initialize, isFireFunctional, isStrict, preinitialize, removeInitializable, setContainer, setName, setSuppressingPropagation, setToken, wrapup
-
Methods inherited from class ptolemy.data.expr.Parameter
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice
-
Methods inherited from class ptolemy.data.expr.Variable
_description, _evaluate, _getCurrentExpression, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _setToken, _setTokenAndNotify, addValueListener, attributeChanged, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isSuppressVariableSubstitution, isTypeAcceptable, removeValueListener, reset, setLazy, setParseTreeEvaluator, setStringMode, setSuppressVariableSubstitution, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setValueListenerAsWeakDependency, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, valueChanged
-
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 ptolemy.kernel.util.NamedObj
_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
-
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
-
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
-
-
-
-
Field Detail
-
inferValueFromContextCount
public int inferValueFromContextCount
-
isSuppressingPropagationCount
public int isSuppressingPropagationCount
-
setExpressionCount
public int setExpressionCount
-
sharedParameterSetCount
public int sharedParameterSetCount
-
validateCount
public int validateCount
-
propagateValueCount
public int propagateValueCount
-
-
Constructor Detail
-
TestSharedParameter
public TestSharedParameter(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a parameter with the given container and name. The container class will be used to determine which other instances of TestSharedParameter are shared with this one. NOTE: Do not use this constructor if you plan to set a default value. Use the four argument constructor instead.- Parameters:
container- The container.name- The name of the parameter.- Throws:
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.
-
TestSharedParameter
public TestSharedParameter(NamedObj container, java.lang.String name, java.lang.Class containerClass) throws IllegalActionException, NameDuplicationException
Construct a parameter with the given container, name, and container class. The specified class will be used to determine which other instances of TestSharedParameter are shared with this one. NOTE: Do not use this constructor if you plan to set a default value. Use the four argument constructor instead.- Parameters:
container- The container.name- The name of the parameter.containerClass- The class used to determine shared instances.- Throws:
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.
-
TestSharedParameter
public TestSharedParameter(NamedObj container, java.lang.String name, java.lang.Class containerClass, java.lang.String defaultValue) throws IllegalActionException, NameDuplicationException
Construct a parameter with the given container, name, container class, and default value. This is the preferred constructor to use. The specified class will be used to determine which other instances of TestSharedParameter are shared with this one.- Parameters:
container- The container.name- The name of the parameter.containerClass- The class used to determine shared instances.defaultValue- The default value to use if the container's model has no shared parameters.- Throws:
IllegalActionException- If the parameter is not of an acceptable class for the container, or an empty string to specify no default value.NameDuplicationException- If the name coincides with a parameter already in the container.
-
-
Method Detail
-
inferValueFromContext
public void inferValueFromContext(java.lang.String defaultValue)
Infer the value of this parameter from the container context. That is, search for parameters that are shared with this one, and set the value of this parameter to match the last one encountered. If there are no shared parameters, then assign the default value given as an argument.- Overrides:
inferValueFromContextin classSharedParameter- Parameters:
defaultValue- The default parameter value to give.- Throws:
InternalErrorException- If there are multiple shared parameters in the model, but their values do not match.
-
isSuppressingPropagation
public boolean isSuppressingPropagation()
Return true if this instance is suppressing propagation. Unless setSuppressingPropagation() has been called, this returns false.- Overrides:
isSuppressingPropagationin classSharedParameter- Returns:
- Returns whether this instance is suppressing propagation.
- See Also:
SharedParameter.setSuppressingPropagation(boolean)
-
setExpression
public void setExpression(java.lang.String expression)
Override the base class to also set the expression of shared parameters.- Specified by:
setExpressionin interfaceSettable- Overrides:
setExpressionin classSharedParameter- Parameters:
expression- The expression.- See Also:
Variable.getExpression()
-
sharedParameterSet
public java.util.Collection sharedParameterSet()
Return a collection of all the shared parameters within the same model as this parameter. If there are no such parameters or if this parameter is deeply contained within an EntityLibrary, then return an empty collection. The list will include this instance if this instance. A shared parameter is one that is an instance of TestSharedParameter, has the same name as this one, and is contained by the container class specified in the constructor.- Overrides:
sharedParameterSetin classSharedParameter- Returns:
- A list of parameters.
-
validate
public java.util.Collection validate() throws IllegalActionExceptionOverride the base class to also validate the shared instances.- Specified by:
validatein interfaceSettable- Overrides:
validatein classSharedParameter- Returns:
- A Collection of all the shared parameters within the same
model as this parameter, see
SharedParameter.sharedParameterSet(). - Throws:
IllegalActionException- If this variable or a variable dependent on this variable cannot be evaluated (and is not lazy) and the model error handler throws an exception. Also thrown if the change is not acceptable to the container.
-
_propagateValue
protected void _propagateValue(NamedObj destination) throws IllegalActionException
Override the base class to do the propagation only if the specified destination is not shared.- Overrides:
_propagateValuein classSharedParameter- Parameters:
destination- Object to which to propagate the value.- Throws:
IllegalActionException- If the value cannot be propagated.
-
getCounts
public java.lang.String getCounts()
Return the current counts.- Returns:
- The current counts.
-
-