//code.append(_codeGenerator.comment(2,
// "Fire Composite "
// + getComponent().getName()));
code.append(super.generateFireCode());
Director directorHelper = (Director) _getHelper(((ptolemy.actor.CompositeActor) getComponent())
.getDirector());
Iterator inputPorts = ((ptolemy.actor.CompositeActor) getComponent())
.inputPortList().iterator();
// Update port parameters.
StringBuffer tempCode = new StringBuffer();
while (inputPorts.hasNext()) {
IOPort inputPort = (IOPort) inputPorts.next();
if (inputPort instanceof ParameterPort && inputPort.getWidth() > 0) {
PortParameter portParameter = ((ParameterPort) inputPort)
.getParameter();
tempCode.append(CodeStream.indent(_codeGenerator
.generateVariableName(portParameter)));
// FIXME: The = sign is language specific.
tempCode.append(" = ");
tempCode.append(getReference(inputPort.getName()));
tempCode.append(";" + _eol);
}
}
if (tempCode.length() > 0) {
code.append(CodeStream.indent(_codeGenerator.comment("Update "
+ getComponent().getName() + "'s port parameters")));
code.append(tempCode);
}
// Transfer the data to the inside.
inputPorts = ((ptolemy.actor.CompositeActor) getComponent())
.inputPortList().iterator();
while (inputPorts.hasNext()) {
IOPort inputPort = (IOPort) inputPorts.next();
if (!(inputPort instanceof ParameterPort)) {
directorHelper.generateTransferInputsCode(inputPort, code);
}
}
// Generate the fire code by the director helper.
code.append(directorHelper.generateFireCode());
// Transfer the data to the outside.
Iterator outputPorts = ((ptolemy.actor.CompositeActor) getComponent())
.outputPortList().iterator();
while (outputPorts.hasNext()) {
IOPort outputPort = (IOPort) outputPorts.next();
directorHelper.generateTransferOutputsCode(outputPort, code);
}
return code.toString();
}