CompositeActor castContainer = (CompositeActor) container;
// Get the functionDependency attribute of the container of this
// director. If there is no such attribute, construct one.
FunctionDependencyOfCompositeActor functionDependency = (FunctionDependencyOfCompositeActor) castContainer
.getFunctionDependency();
// NOTE: The following may be a very costly test.
// -- from the comments of previous implementations.
// If the port based data flow graph contains directed
// loops, the model is invalid. An IllegalActionException
// is thrown with the names of the actors in the loop.
Object[] cycleNodes = functionDependency.getCycleNodes();
if (cycleNodes.length != 0) {
StringBuffer names = new StringBuffer();
for (int i = 0; i < cycleNodes.length; i++) {
if (cycleNodes[i] instanceof Nameable) {
if (i > 0) {
names.append(", ");
}
names.append(((Nameable) cycleNodes[i]).getContainer()
.getFullName());
}
}
throw new IllegalActionException(this.getContainer(),
"Found zero delay loop including: " + names.toString());
}
portsGraph = functionDependency.getDetailedDependencyGraph()
.toDirectedAcyclicGraph();
return portsGraph;
}