|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmocgraph.sched.ScheduleElement
mocgraph.sched.Schedule
mapss.dif.mdsdf.sched.MDSchedule
public class MDSchedule
The schedule class for multi-dimensional dataflow. This class extends
from mocgraph.sched.Schedule
for supporting
multi-dimensional (MD or m-d) iteration counts.
The "iteration count" is still in one-dimensional because it is inherited
from mocgraph.sched.ScheduleElement
. The new variable
"multi-dimensional iteration count" is created for specifying
multi-dimensional iteration count.
Suppose that R = [r1, r2, ..., rM] is a multi-dimensional iteration count, where Mis the dimensionality. Then r = r1 * r2 * ... * rM is the converted version of original one-dimensional iteration count.
Use setMDIterationCount(int[])
and getMDIterationCount()
to set and get R = [r1, r2, ..., rM].
r = r1 * r2 * ... * rM will automatically be computed.
Using setIterationCount(int)
will cause an error but
using getIterationCount()
will return r = r1 * r2 * ... * rM.
Each schedule element in the MDSchedule must has the same dimension as
the MDSchedule. The dimension of iteration count of the MDSchedule must be
also consistent with the dimension of the MDSchedule. As a result,
MDSchedule(int)
is the most recommended constructor because it sets
the dimension during initialization. An user can also call
setDimension(int)
to set the dimension of the MDSchedule if he uses
other constructors. Once the dimension is set, it cannot be changed.
The reason to force this constraint is to prevent the schedule elements have
different dimenisons than the parent schedule.
This class represents a multi-dimensional static schedule of firing elements invocation. An instance of this class is returned by the scheduler of a multi-dimensional dataflow model to represent order of firing element firings in the model. A schedule consists of a list of schedule elements and the number of times the schedule should repeat.
Each element of the schedule is represented by an instance of the
MDFiring
or MDSchedule
. Each element may correspond
to a number of firings of a single firing element (represented by the
MDFiring
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 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 MDSchedule or MDFiring can be added to the schedule list.
The iteration count is set by the setMDIterationCount(int[])
method.
If this method is not invoked, a default value of {1} will be used.
Take a look of an example. Suppose that we have a MDSDF graph containing actors
A, B, C, and D, with the firing order
[1,8]A [8,1]B [2,2]([2,1]C [1,2]D)
.
The code to create this schedule appears below.
MDSchedule S1 = new MDSchedule(2); MDFiring FA = new MDFiring(); MDFiring FB = new MDFiring(); MDSchedule S2 = new MDSchedule(2); MDFiring FC = new MDFiring(); MDFiring FD = new MDFiring(); FA.setFiringElement(A); int[] itA = {1,8}; FA.setMDIterationCount(itA); FB.setFiringElement(B); int[] itB = {8,1}; FB.setMDIterationCount(itB); S1.add(FA); S1.add(FB); FC.setFiringElement(C); int[] itC = {2,1}; FC.setMDIterationCount(itC); FD.setFiringElement(D); int[] itD = {1,2}; FD.setMDIterationCount(itD); S2.add(FC) S2.add(FD); int[] itS2 = {2,2}; S2.setMDIterationCount(itS2); S1.add(S2);
MDFiring
,
Schedule
,
ScheduleElement
Field Summary |
---|
Fields inherited from class mocgraph.sched.Schedule |
---|
_schedule |
Fields inherited from class mocgraph.sched.ScheduleElement |
---|
_parent |
Constructor Summary | |
---|---|
MDSchedule()
Construct a multi-dimensional schedule with iteration count {1} and an empty schedule list. |
|
MDSchedule(java.lang.Class firingElementClass)
Construct a multi-dimensional schedule with iteration count {1} and an empty schedule list. |
|
MDSchedule(int dimension)
Construct a multi-dimensional schedule with multi-dimensional iteration count set to int[dimension] with all
elements equal to one, and an empty schedule list. |
Method Summary | |
---|---|
void |
add(int index,
mocgraph.sched.ScheduleElement element)
Insert the specified schedule element at the specified position in the schedule list. |
void |
add(mocgraph.sched.ScheduleElement element)
Append the specified schedule element to the end of the schedule list. |
int |
getDimension()
Get the dimension of this MDSchedule. |
int[] |
getMDIterationCount()
Get the multi-dimensional iteration count for this multi-dimensional schedule. |
void |
setDimension(int dimension)
Set the dimension of this schedule. |
void |
setIterationCount(int count)
Invalidate ScheduleElement.setIterationCount(int) . |
void |
setMDIterationCount(int[] iteration)
Set the multi-dimensional iteration count for this multi-dimensional schedule. |
java.lang.String |
toParenthesisString(java.util.Map nameMap,
java.lang.String delimiter)
Print the schedule in a nested parenthesis style. |
java.lang.String |
toString()
Output a string representation of this Schedule. |
Methods inherited from class mocgraph.sched.Schedule |
---|
appearanceCount, firingElementIterator, firingIterator, firings, get, iterator, lexicalOrder, maxAppearanceCount, remove, size |
Methods inherited from class mocgraph.sched.ScheduleElement |
---|
_getVersion, _incrementVersion, firingElementClass, getIterationCount, getParent, setParent, toParenthesisString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MDSchedule()
public MDSchedule(java.lang.Class firingElementClass)
ScheduleElement
s containing firing elements of the given class
would only be accepted as next elements for this schedule.
firingElementClass
- The given class type.public MDSchedule(int dimension)
int[dimension]
with all
elements equal to one, and an empty schedule list. Is is very
recommended to use this constructor or use setDimension(int)
after initialization.
dimension
- The dimension of this schedule.
MDScheduleException
- If dimension is less
than one.Method Detail |
---|
public void add(mocgraph.sched.ScheduleElement element)
add
in class mocgraph.sched.Schedule
element
- The MDFiring or MDSchedule object to add.
MDScheduleException
- If element is not instanceof
MDFiring or MDSchedule, or if element has dimension
different than the dimension of this schedule.public void add(int index, mocgraph.sched.ScheduleElement element)
add
in class mocgraph.sched.Schedule
index
- The index at which the specified element is to be
inserted.element
- The MDFiring or MDSchedule object to add.
If
- element is not instanceof
MDFiring or MDSchedule, or if element has dimension
different than the dimension of this schedule.
java.lang.IndexOutOfBoundsException
- If the specified index is out of
range (index < 0 || index > size()).public int getDimension()
public int[] getMDIterationCount()
public void setDimension(int dimension)
int[dimension]
with all elements
equal to one.
dimension
- The new dimension of this schedule.
MDScheduleException
- If dimension is less
than one or the dimension of this schedule has been set.public void setIterationCount(int count)
ScheduleElement.setIterationCount(int)
.
Use setMDIterationCount(int[])
instead.
setIterationCount
in class mocgraph.sched.ScheduleElement
count
-
MDScheduleException
- Throws exception in all case.public void setMDIterationCount(int[] iteration)
iteration
- The multi-dimensional iteration count for this
multi-dimensional firing.
MDScheduleException
- If iteration is not equal to
the dimension of this schedule.public java.lang.String toParenthesisString(java.util.Map nameMap, java.lang.String delimiter)
toParenthesisString
in class mocgraph.sched.Schedule
nameMap
- The map from firing elements to their short names.delimiter
- The delimiter between iterands.
public java.lang.String toString()
toString
in class mocgraph.sched.Schedule
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |