* external ports are not correct.
*/
protected Schedule _getParallelSchedule() throws NotSchedulableException,
IllegalActionException {
SDFDirector director = (SDFDirector) getContainer();
CompositeActor model = (CompositeActor) director.getContainer();
_checkDynamicRateVariables(model, _rateVariables);
int vectorizationFactor = 1;
//if (director instanceof SDFDirector) {
Token token = director.vectorizationFactor.getToken();
vectorizationFactor = ((IntToken) token).intValue();
//}
if (vectorizationFactor < 1) {
throw new NotSchedulableException(this,
"The supplied vectorizationFactor must be "
+ "a positive integer. " + "The given value was: "
+ vectorizationFactor);
}
CompositeActor container = (CompositeActor) director.getContainer();
// A linked list containing all the actors.
LinkedList allActorList = new LinkedList();
// Populate it.
for (Iterator entities = container.deepEntityList().iterator(); entities
.hasNext();) {
ComponentEntity entity = (ComponentEntity) entities.next();
// Fill allActorList with the list of things that we can schedule
// FIXME: What if other things can be scheduled than actors?
if (entity instanceof Actor) {
allActorList.addLast(entity);
}
}
// externalRates maps from external
// ports to the number of tokens that that port
// will produce or consume in each firing.
// It gets populated with the fractional production ratios
// and is used in the end to set final rates on external ports.
// This map is initialized to zero.
Map externalRates = new TreeMap(new DFUtilities.NamedObjComparator());
// Initialize externalRates to zero.
for (Iterator ports = container.portList().iterator(); ports.hasNext();) {
IOPort port = (IOPort) ports.next();
externalRates.put(port, Fraction.ZERO);
}
// An association between all the relations in a simulation and
// and array of the maximum number of tokens that are ever
// waiting on that relation.
Map minimumBufferSize = new TreeMap(
new DFUtilities.NamedObjComparator());
// Initialize the buffer size of each relation to zero.
for (Iterator relations = container.relationList().iterator(); relations
.hasNext();) {
Relation relation = (Relation) relations.next();
minimumBufferSize.put(relation, Integer.valueOf(0));
}