Class IterativeParameter

    • Constructor Detail

      • IterativeParameter

        public IterativeParameter​(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

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        React to a change in an attribute. This method is called by a contained attribute when its value changes. In this base class, the method does nothing. In derived classes, this method may throw an exception, indicating that the new attribute value is invalid. It is up to the caller to restore the attribute to a valid value if an exception is thrown.
        Overrides:
        attributeChanged in class Variable
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the change is not acceptable to this container (not thrown in this base class).
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the variable. This creates a new variable containing the same token (if the value was set with setToken()) or the same (unevaluated) expression, if the expression was set with setExpression(). The list of variables added to the scope is not cloned; i.e., the clone has an empty scope. The clone has the same static type constraints (those given by setTypeEquals() and setTypeAtMost()), but none of the dynamic type constraints (those relative to other variables).
        Overrides:
        clone in class Parameter
        Parameters:
        workspace - The workspace in which to place the cloned variable.
        Returns:
        The cloned variable.
        Throws:
        java.lang.CloneNotSupportedException - Not thrown in this base class.
        See Also:
        Object.clone()
      • foundMatch

        public boolean foundMatch​(GraphMatcher matcher)
        A routine to be called when a match is found in the graph matching. The graph matcher is passed in as the parameter, and the current match can be obtained by calling GraphMatcher.getMatchResult(). This match result should not be kept, however, because it may be changed by future matching operations. To keep a copy of this result, invoke MatchResult.clone() and keep the cloned copy. The return value indicates whether the match is the one looked for. If it is true, the matching will terminate after this routine returns, and no more match result will be reported.
        Specified by:
        foundMatch in interface MatchCallback
        Parameters:
        matcher - The graph matcher.
        Returns:
        Whether the matching should terminate right away.
      • validate

        public java.util.Collection<?> validate()
                                         throws IllegalActionException
        If this variable is not lazy (the default) then evaluate the expression contained in this variable, and notify any value dependents. If those are not lazy, then they too will be evaluated. Also, if the variable is not lazy, then notify its container, if there is one, by calling its attributeChanged() method.

        If this variable is lazy, then mark this variable and any of its value dependents as needing evaluation and for any value dependents that are not lazy, evaluate them. Note that if there are no value dependents, or if they are all lazy, then this will not result in evaluation of this variable, and hence will not ensure that the expression giving its value is valid. Call getToken() or getType() to accomplish that.

        Specified by:
        validate in interface Settable
        Overrides:
        validate in class Variable
        Returns:
        The current list of value listeners, which are evaluated as a consequence of this call to validate().
        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.
      • _validateConstraint

        protected void _validateConstraint()
                                    throws IllegalActionException
        Validate the constraint.
        Throws:
        IllegalActionException - If the constraint is violated, or if the current value of the parameter cannot be retrieved.