Class Ramp

    • Field Detail

      • init

        public PortParameter init
        The value produced by the ramp on its first iteration. If this value is changed during execution, then the new value will be the output on the next iteration. The default value of this parameter is the integer 0.
      • step

        public PortParameter step
        The amount by which the ramp output is incremented on each iteration. The default value of this parameter is the integer 1.
    • Constructor Detail

      • Ramp

        public Ramp​(CompositeEntity container,
                    java.lang.String name)
             throws NameDuplicationException,
                    IllegalActionException
        Construct an actor with the given container and name. In addition to invoking the base class constructors, construct the init and step parameter and the step port. Initialize init to IntToken with value 0, and step to IntToken with value 1.
        Parameters:
        container - The container.
        name - The name of this actor.
        Throws:
        IllegalActionException - If the actor cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the actor into the specified workspace. This calls the base class and then sets the init and step public members to the parameters of the new actor.
        Overrides:
        clone in class TypedAtomicActor
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new actor.
        Throws:
        java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)
      • iterate

        public int iterate​(int count)
                    throws IllegalActionException
        Invoke a specified number of iterations of this actor. Each iteration updates the state of the actor by adding the value of the step parameter to the state and sending the value of the state to the output. The iteration count is also incremented by the value of count, and if the result is greater than or equal to firingCountLimit then return STOP_ITERATING.

        This method should be called instead of the usual prefire(), fire(), postfire() methods when this actor is used in a domain that supports vectorized actors. This leads to more efficient execution.

        Specified by:
        iterate in interface Executable
        Overrides:
        iterate in class AtomicActor<TypedIOPort>
        Parameters:
        count - The number of iterations to perform.
        Returns:
        COMPLETED if the actor was successfully iterated the specified number of times. Otherwise, if the maximum iteration count has been reached, return STOP_ITERATING.
        Throws:
        IllegalActionException - If iterating cannot be performed.
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        Update the state of the actor by adding the value of the step parameter to the state. Also, increment the iteration count, and if the result is equal to firingCountLimit, then return false.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class LimitedFiringSource
        Returns:
        False if the number of iterations matches the number requested.
        Throws:
        IllegalActionException - If the firingCountLimit parameter has an invalid expression.