ptolemy.actor.sched
Class Firing

java.lang.Object
  extended byptolemy.actor.sched.ScheduleElement
      extended byptolemy.actor.sched.Firing

public class Firing
extends ScheduleElement

This class is a schedule element that contains a reference to an actor. This class is used together with the Schedule class to construct a static schedule. This class contains a reference to an actor, and is used to represent an actor term of a schedule loop. The setActor() method is used to create the reference to an actor. The getActor() method will return a reference to this actor.

It is more efficient to use this class than to simply maintain a list of actors since actors will often firing 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: Firing.java,v 1.34 2004/04/13 05:12:46 cxh Exp $
Author:
Brian K. Vogel, Steve Neuendorffer
See Also:
Schedule, ScheduleElement
Accepted Rating:
Yellow (chf)
Proposed Rating:
Green (vogel)

Field Summary
 
Fields inherited from class ptolemy.actor.sched.ScheduleElement
_parent
 
Constructor Summary
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.
 
Method Summary
 java.util.Iterator actorIterator()
          Return the actor invocation sequence of the schedule in the form of a sequence of actors.
 java.util.Iterator firingIterator()
          Return the actor invocation sequence in the form of a sequence of firings.
 Actor getActor()
          Get the actor associated with this Firing.
 void setActor(Actor actor)
          Set the actor associated with this firing.
 java.lang.String toString()
          Output a string representation of this Firing.
 
Methods inherited from class ptolemy.actor.sched.ScheduleElement
_getVersion, _incrementVersion, getIterationCount, setIterationCount, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 Firing. 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, 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.

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.

toString

public java.lang.String toString()
Output a string representation of this Firing.