use of com.jopdesign.wcet.uppaal.model.LayoutCFG in project jop by jop-devel.
the class TemplateBuilder method getFinalTemplate.
public Template getFinalTemplate() {
if (outgoingAttrs == null)
return this.template;
for (int i = 0; i < loopVarBounds.size(); i++) {
template.appendDeclaration(String.format("int[0,%s] %s;", loopVarBounds.get(i), loopVarName(i)));
}
if (loopVarBounds.size() > 0) {
StringBuilder rst = new StringBuilder();
rst.append("void rst() {\n");
for (int i = 0; i < loopVarBounds.size(); i++) {
rst.append(String.format(" %s = 0;\n", loopVarName(i)));
}
rst.append("} \n");
template.appendDeclaration(rst.toString());
}
for (Location l : template.getLocations()) {
TransitionAttributes in = incomingAttrs.get(l);
if (in != null) {
for (Transition t : l.getPredecessors()) {
t.getAttrs().addAttributes(in);
}
}
TransitionAttributes out = outgoingAttrs.get(l);
if (out != null) {
for (Transition t : l.getSuccessors()) {
t.getAttrs().addAttributes(out);
}
}
}
outgoingAttrs = incomingAttrs = null;
/* debug: create dot file */
if (config.debug) {
File dbgFile = config.getOutFile("template_" + template.getId() + ".dot");
try {
template.exportDOT(dbgFile);
} catch (IOException e) {
e.printStackTrace();
}
}
new LayoutCFG(100, 120).layoutCfgModel(template);
return template;
}
Aggregations