Class Firing

  • Direct Known Subclasses:
    BufferingProfileFiring, SequenceFiring

    public class Firing
    extends ScheduleElement
    This class is a schedule element that contains a reference to an actor and an iteration count. This class is used together with the Schedule class to construct a static schedule. This class is used to represent a single actor repeated some number of times, whereas Schedule is used for multi-actor schedules. The setActor() method is used to create the reference to an actor, and the setIterationCount() method to set the iteration count. The getActor() method will return a reference to this actor, and getIterationCount() will return the iteration count.

    It is more efficient to use this class than to simply maintain a list of actors since actors will often fire multiple times consecutively. Using this class (and the Schedule data structure in general) greatly reduces the memory requirements of most large schedules.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Brian K. Vogel, Steve Neuendorffer
    See Also:
    Schedule, ScheduleElement
    Pt.AcceptedRating:
    Yellow (chf)
    Pt.ProposedRating:
    Green (vogel)
    • Constructor Summary

      Constructors 
      Constructor Description
      Firing()
      Construct a firing with a default iteration count equal to one and with no parent schedule.
      Firing​(Actor actor)
      Construct a firing with a actor, an iteration count equal to one and no parent schedule.
    • Constructor Detail

      • Firing

        public Firing()
        Construct a firing with a default iteration count equal to one and with no parent schedule.
      • Firing

        public Firing​(Actor actor)
        Construct a firing with a actor, an iteration count equal to one and no parent schedule.
        Parameters:
        actor - The actor in the firing.
    • Method Detail

      • actorIterator

        public java.util.Iterator actorIterator()
        Return the actor invocation sequence of the schedule in the form of a sequence of actors. For a valid schedule, all of the lowest-level nodes should be an instance of Actor. If the schedule is not valid, then the returned iterator will contain null elements.

        A runtime exception is thrown if the underlying schedule structure is modified while the iterator is active.

        Specified by:
        actorIterator in class ScheduleElement
        Returns:
        An iterator over a sequence of actors.
        Throws:
        java.util.ConcurrentModificationException - If the underlying schedule structure is modified while the iterator is active.
      • firingIterator

        public java.util.Iterator firingIterator()
        Return the actor invocation sequence in the form of a sequence of firings. Since this ScheduleElement is a Firing, which represents an Actor and an iteration count. the iterator returned will contain exactly one Firing (this Firing).

        A runtime exception is thrown if the underlying schedule structure is modified while the iterator is active.

        Specified by:
        firingIterator in class ScheduleElement
        Returns:
        An iterator over a sequence of firings.
        Throws:
        java.util.ConcurrentModificationException - If the underlying schedule structure is modified while the iterator is active.
      • getActor

        public Actor getActor()
        Get the actor associated with this Firing. The setActor() method is used to set the actor that this method returns. If setActor() was never called, then throw an exception.
        Returns:
        The actor associated with this Firing.
        See Also:
        setActor(Actor)
      • setActor

        public void setActor​(Actor actor)
        Set the actor associated with this firing. This actor will then be returned when the getActor() method is invoked. If this firing already contains a reference to an actor, then the reference will overwritten.
        Parameters:
        actor - The actor to associate with this firing.
        See Also:
        getActor()
      • toString

        public java.lang.String toString()
        Output a string representation of this Firing.
        Overrides:
        toString in class java.lang.Object