Class AbstractDDI

  • All Implemented Interfaces:
    Executable, Initializable, DDI
    Direct Known Subclasses:
    CSP, Dataflow

    public abstract class AbstractDDI
    extends java.lang.Object
    implements DDI
    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Christopher Chang
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Detail

      • AbstractDDI

        public AbstractDDI()
    • Method Detail

      • isFireFunctional

        public boolean isFireFunctional()
        Return true. Most actors are written so that the prefire() and fire() methods do not change the state of the actor. Hence, for convenience, this base class by default returns true. An actor that does change state in prefire() or fire() must override this method to return false.
        Specified by:
        isFireFunctional in interface Executable
        Returns:
        True.
      • isStrict

        public boolean isStrict()
        Return true in this base class. By default, actors do not check their inputs to see whether they are known. They assume they are known. A derived class that can tolerate unknown inputs should override this method to return false.
        Specified by:
        isStrict in interface Executable
        Returns:
        True always in this base class.
      • iterate

        public int iterate​(int i)
                    throws IllegalActionException
        Description copied from interface: Executable
        Invoke a specified number of iterations of the actor. An iteration here is equivalent to invoking prefire(), fire(), and postfire(), in that order. In an iteration, if prefire() returns true, then fire() will be called once, followed by postfire(). Otherwise, if prefire() returns false, fire() and postfire() are not invoked, and this method returns NOT_READY. If postfire() returns false, then no more iterations are invoked, and this method returns STOP_ITERATING. Otherwise, it returns COMPLETED.

        An implementation of this method is not required to actually invoke prefire(), fire(), and postfire(). An implementation of this method must, however, perform the equivalent operations.

        Note that this method for iterating an actor should be used only in domains where a single invocation of prefire() and fire() is sufficient in an iteration.

        Specified by:
        iterate in interface Executable
        Parameters:
        i - The number of iterations to perform.
        Returns:
        NOT_READY, STOP_ITERATING, or COMPLETED.
        Throws:
        IllegalActionException - If iterating is not permitted, or if prefire(), fire(), or postfire() throw it.
      • stop

        public void stop()
        Description copied from interface: Executable
        Request that execution of this Executable stop as soon as possible. An implementation of this method should pass on the request to any contained executable objects. An implementation should also return false from postfire() to indicate to the caller that no further execution of this Executable is appropriate. After this method is called, the executable object should not be fired again. The stopFire() method, by contrast, requests that the current iteration be completed, but not that the entire execution be stopped. I.e., the Executable may be fired again after stopFire() is called.
        Specified by:
        stop in interface Executable
      • stopFire

        public void stopFire()
        Description copied from interface: Executable
        Request that execution of the current iteration complete. If an iteration is always a finite computation (the usual case), i.e. the fire() method always returns in finite time, then nothing needs to be done in this method, except possibly to pass on the request to any contained executable objects. This method is used to request that an unbounded computation suspend, returning control to the caller. Thus, if the fire() method does not normally return in finite time, then this method is used to request that it return. It should suspend execution in such a way that if the fire() method is called again, execution will resume at the point where it was suspended. However, it should not assume the fire() method will be called again. It is possible that the wrapup() method will be called next.
        Specified by:
        stopFire in interface Executable
      • terminate

        public void terminate()
        Description copied from interface: Executable
        Terminate any currently executing model with extreme prejudice. This method is not intended to be used as a normal route of stopping execution. To normally stop execution, call the finish() method instead. This method should be called only when execution fails to terminate by normal means due to certain kinds of programming errors (infinite loops, threading errors, etc.).

        After this method completes, all resources in use should be released and any sub-threads should be killed. However, a consistent state is not guaranteed. The topology should probably be recreated before attempting any further operations. This method should not be synchronized because it must happen as soon as possible, no matter what.

        Specified by:
        terminate in interface Executable
      • wrapup

        public void wrapup()
                    throws IllegalActionException
        Description copied from interface: Initializable
        This method is invoked exactly once per execution of an application. None of the other action methods should be be invoked after it. It finalizes an execution, typically closing files, displaying final results, etc. When this method is called, no further execution should occur.
        Specified by:
        wrapup in interface Initializable
        Throws:
        IllegalActionException - If wrapup is not permitted.