This class represents a static schedule of actor executions. An instance of this class is returned by the scheduler of a model to represent order of actor firings in the model. A schedule consists of a list of schedule elements and the number of times the schedule should repeat (called the
iteration count).
Each element of the schedule is represented by an instance of the ScheduleElement class. Each element may correspond to a number of firings of a single actor (represented by the Firing class) or an entire sub-schedule (represented by a hierarchically contained instance of this class). This nesting allows this concise representation of looped schedules. The nesting can be arbitrarily deep, but must be a tree where the leaf nodes represent actor firings. It is up to the scheduler to enforce this requirement.
The add() and remove() methods are used to add or remove schedule elements. Only elements of type ScheduleElement (Schedule or Firing) may be added to the schedule list. Otherwise an exception will occur.
The iteration count is set by the setIterationCount() method. If this method is not invoked, a default value of one will be used.
As an example, suppose that we have an SDF graph containing actors A, B, C, and D, with the firing order ABCBCBCDD. This firing order can be represented by a simple looped schedule. The code to create this schedule appears below.
Schedule S = new Schedule(); Firing S1 = new Firing(); Schedule S2 = new Schedule(); Firing S3 = new Firing(); S.add(S1); S.add(S2); S.add(S3); S1.setActor(A); S2.setIterationCount(3); Firing S2_1 = new Firing(); Firing S2_2 = new Firing(); S2_1.setActor(B); S2_2.setActor(C); S2.add(S2_1); S2.add(S2_2); S3.setIterationCount(2); S3.setActor(D);
Note that this implementation is not synchronized. It is therefore not safe for a thread to make modifications to the schedule structure while multiple threads are concurrently accessing the schedule.
References
S. S. Bhattacharyya, P K. Murthy, and E. A. Lee, Software Syntheses from Dataflow Graphs, Kluwer Academic Publishers, 1996.
@author Brian K. Vogel, Steve Neuendorffer
@version $Id: Schedule.java,v 1.51 2007/12/06 18:18:34 cxh Exp $
@since Ptolemy II 1.0
@Pt.ProposedRating Green (vogel)
@Pt.AcceptedRating Yellow (chf)
@see ptolemy.actor.sched.Firing
@see ptolemy.actor.sched.ScheduleElement