Package ptolemy.actor

Class FiringEvent

  • All Implemented Interfaces:
    DebugEvent

    public class FiringEvent
    extends java.lang.Object
    implements DebugEvent
    An event that is published by directors whenever an actor is activated. An activation occurs whenever an actor is prefired, fired, or postfired. The appropriate event should be published just before or after the associated method of the executable interface is called. The iterate event is published by those directors which vectorize firings of a particular actor. This event may be published instead of many individual prefire, fire and postfire events. As an example of how to implement a director that publishes these events, see the SDF Director. One way in which these events are used is to trace the firings of different actors. A user interface can also implement a breakpoint mechanism by pausing execution of the executing thread in response to one of these events.

    Note that since most directors work with a constant set of actors, and fire them repeatedly, it may improve efficiency dramatically to use a flyweight design pattern with firing events. This can result in greatly reducing the load on the garbage collector.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Steve Neuendorffer
    See Also:
    DebugListener
    Pt.AcceptedRating:
    Yellow (neuendor)
    Pt.ProposedRating:
    Green (neuendor)
    • Field Detail

      • AFTER_PREFIRE

        public static final FiringEvent.FiringEventType AFTER_PREFIRE
        This type of event is published after a prefire method is called.
      • AFTER_FIRE

        public static final FiringEvent.FiringEventType AFTER_FIRE
        This type of event is published after a fire method is called.
      • AFTER_POSTFIRE

        public static final FiringEvent.FiringEventType AFTER_POSTFIRE
        This type of event is published after a postfire method is called.
      • AFTER_ITERATE

        public static final FiringEvent.FiringEventType AFTER_ITERATE
        This type of event is published after an iterate method is called.
      • BEFORE_PREFIRE

        public static final FiringEvent.FiringEventType BEFORE_PREFIRE
        This type of event is published before a prefire method is called.
      • BEFORE_FIRE

        public static final FiringEvent.FiringEventType BEFORE_FIRE
        This type of event is published before a fire method is called.
      • BEFORE_POSTFIRE

        public static final FiringEvent.FiringEventType BEFORE_POSTFIRE
        This type of event is published before a postfire method is called.
      • BEFORE_ITERATE

        public static final FiringEvent.FiringEventType BEFORE_ITERATE
        This type of event is published before an iterate method is called.
      • BEFORE_RW_FIRE

        public static final FiringEvent.FiringEventType BEFORE_RW_FIRE
        The type of event published as part of the Kepler sql actor.
      • AFTER_RW_FIRE

        public static final FiringEvent.FiringEventType AFTER_RW_FIRE
        The type of event published as part of the Kepler sql actor.
    • Constructor Detail

      • FiringEvent

        public FiringEvent​(Director source,
                           Actor actor,
                           FiringEvent.FiringEventType type)
        Create a new firing event with the given source, actor, and type.
        Parameters:
        source - The director invoking the firing.
        actor - The actor being fired.
        type - An identifier for the method being invoked, which is one of AFTER_PREFIRE, AFTER_FIRE, AFTER_POSTFIRE, AFTER_ITERATE, BEFORE_PREFIRE, BEFORE_FIRE, BEFORE_POSTFIRE, or BEFORE_ITERATE.
      • FiringEvent

        public FiringEvent​(Director source,
                           Actor actor,
                           FiringEvent.FiringEventType type,
                           int multiplicity)
        Create a new firing event with the given source, actor, type, and multiplicity.
        Parameters:
        source - The director invoking the firing.
        actor - The actor being fired.
        type - An identifier for the method being invoked, which is one of AFTER_PREFIRE, AFTER_FIRE, AFTER_POSTFIRE, AFTER_ITERATE, BEFORE_PREFIRE, BEFORE_FIRE, BEFORE_POSTFIRE, or BEFORE_ITERATE.
        multiplicity - The multiplicity of the firing.
    • Method Detail

      • getActor

        public Actor getActor()
        Return the actor that is being activated.
        Returns:
        The actor that is being activated.
      • getDirector

        public Director getDirector()
        Return the director that activated the actor.
        Returns:
        The director that activated the actor.
      • getSource

        public NamedObj getSource()
        Return the source of the event. This class returns the director that activated the actor.
        Specified by:
        getSource in interface DebugEvent
        Returns:
        An instance of Director.
      • getType

        public FiringEvent.FiringEventType getType()
        Return the type of activation that this event represents.
        Returns:
        the type of activation that this event represents.
      • toString

        public java.lang.String toString()
        Return a string representation of this event.
        Specified by:
        toString in interface DebugEvent
        Overrides:
        toString in class java.lang.Object
        Returns:
        A user-readable string describing the event.