Class GTParameter

    • Constructor Detail

      • GTParameter

        public GTParameter​(NamedObj container,
                           java.lang.String name)
                    throws IllegalActionException,
                           NameDuplicationException
        Construct a parameter with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This parameter will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. The object is not added to the list of objects in the workspace unless the container is null. Increment the version of the workspace.
        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.
    • Method Detail

      • _evaluate

        protected void _evaluate​(Pattern pattern,
                                 MatchResult matchResult)
                          throws IllegalActionException
        Evaluate the current expression to a token with the given pattern and match result using GTParameter.Evaluator. If this variable was last set directly with a token, then do nothing. In other words, the expression is evaluated only if the value of the token was most recently given by an expression. The expression is also evaluated if any of the variables it refers to have changed since the last evaluation. If the value of this variable changes due to this evaluation, then notify all value dependents and notify the container (if there is one) by calling its attributeChanged() and attributeTypeChanged() methods, as appropriate. An exception is thrown if the expression is illegal, for example if a parse error occurs or if there is a dependency loop.

        If evaluation results in a token that is not of the same type as the current type of the variable, then the type of the variable is changed, unless the new type is incompatible with statically specified types (setTypeEquals() and setTypeAtMost()). If the type is changed, the attributeTypeChanged() method of the container is called. The container can reject the change by throwing an exception.

        This method may trigger a model error, which is delegated up the container hierarchy until an error handler is found, and is ignored if no error handler is found. A model error occurs if the expression cannot be parsed or cannot be evaluated.

        Part of this method is read-synchronized on the workspace.

        Parameters:
        pattern - The pattern.
        matchResult - The match result for the match between the pattern and a host model.
        Throws:
        IllegalActionException - If the expression cannot be parsed or cannot be evaluated, or if a dependency loop is found.