Class CachedSDFScheduler

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener

    public class CachedSDFScheduler
    extends SDFScheduler
    The CachedSDFScheduler extends the SDFScheduler by caching schedules. The cached schedules are labeled by their corresponding rate signatures, with the most recently used at the beginning of the cache queue. If the rate signatures are contained in the cache keys, then the corresponding schedule in the cache is used. Therefore, we do not need to recompute the schedule again.

    The size of the cache in the CachedSDFScheduler is usually set by its containing director when constructing this scheduler. If the cache is full, the least recently used schedule (at the end of the cache) is discarded.

    Since:
    Ptolemy II 5.2
    Version:
    $Id$
    Author:
    Ye Zhou. Contributor: Brian K. Vogel
    See Also:
    SDFScheduler
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (zhouye)
    • Constructor Detail

      • CachedSDFScheduler

        public CachedSDFScheduler()
        Construct a scheduler with no container(director) in the default workspace, the name of the scheduler is "Scheduler". The cache size is the default value of 0.
      • CachedSDFScheduler

        public CachedSDFScheduler​(Workspace workspace)
        Construct a scheduler in the given workspace with the name "Scheduler". The cache size is the default value of 0. If the workspace argument is null, use the default workspace. The scheduler is added to the list of objects in the workspace. Increment the version number of the workspace.
        Parameters:
        workspace - Object for synchronization and version tracking.
      • CachedSDFScheduler

        public CachedSDFScheduler​(Director container,
                                  java.lang.String name,
                                  int cacheSize)
                           throws IllegalActionException,
                                  NameDuplicationException
        Construct a scheduler in the given container with the given name and given cache size. The container argument must not be null, or a NullPointerException will be thrown. This attribute 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. Increment the version of the workspace.
        Parameters:
        container - The container.
        name - The name of this attribute.
        cacheSize - The cache size of this scheduler.
        Throws:
        IllegalActionException - If the super class throws it.
        NameDuplicationException - If the super class throws it.
    • Method Detail

      • clearCaches

        public void clearCaches()
        Clear the schedule cache, cache keys and cache for external rates of this scheduler.
      • constructCaches

        public void constructCaches​(int cacheSize)
        Construct the caches of this scheduler with the given cache size.
        Parameters:
        cacheSize - The given cache sie.