Class TestSharedParameter

    • 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:
        inferValueFromContext in class SharedParameter
        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.
      • 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:
        sharedParameterSet in class SharedParameter
        Returns:
        A list of parameters.
      • validate

        public java.util.Collection validate()
                                      throws IllegalActionException
        Override the base class to also validate the shared instances.
        Specified by:
        validate in interface Settable
        Overrides:
        validate in class SharedParameter
        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.
      • getCounts

        public java.lang.String getCounts()
        Return the current counts.
        Returns:
        The current counts.