Search in sources :

Example 1 with Location

use of com.jopdesign.wcet.uppaal.model.Location in project jop by jop-devel.

the class TemplateBuilder method createLocation.

private Location createLocation(String name, LocationAttribute lAttr) {
    Location l = new Location(name, lAttr);
    this.template.addLocation(l);
    return l;
}
Also used : Location(com.jopdesign.wcet.uppaal.model.Location)

Example 2 with Location

use of com.jopdesign.wcet.uppaal.model.Location 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;
}
Also used : TransitionAttributes(com.jopdesign.wcet.uppaal.model.TransitionAttributes) Transition(com.jopdesign.wcet.uppaal.model.Transition) IOException(java.io.IOException) File(java.io.File) Location(com.jopdesign.wcet.uppaal.model.Location) LayoutCFG(com.jopdesign.wcet.uppaal.model.LayoutCFG)

Example 3 with Location

use of com.jopdesign.wcet.uppaal.model.Location in project jop by jop-devel.

the class TemplateBuilder method addPostEnd.

/** add a final node */
public void addPostEnd() {
    if (postEnd != null)
        throw new AssertionError("Called addPostEnd twice");
    postEnd = new Location("EE");
    template.addLocation(postEnd);
    template.addTransition(new Transition(getEnd(), postEnd));
}
Also used : Transition(com.jopdesign.wcet.uppaal.model.Transition) Location(com.jopdesign.wcet.uppaal.model.Location)

Example 4 with Location

use of com.jopdesign.wcet.uppaal.model.Location in project jop by jop-devel.

the class TemplateBuilder method createSubAutomaton.

/** create a subautomaton in the template */
public SubAutomaton createSubAutomaton(String name) {
    Location subI = new Location("I_" + name);
    subI.setCommited();
    Location subE = new Location("E_" + name);
    subE.setCommited();
    template.addLocation(subI);
    template.addLocation(subE);
    return new SubAutomaton(subI, subE);
}
Also used : Location(com.jopdesign.wcet.uppaal.model.Location)

Example 5 with Location

use of com.jopdesign.wcet.uppaal.model.Location in project jop by jop-devel.

the class MethodBuilder method createSpecialCommited.

private SubAutomaton createSpecialCommited(String name, ControlFlowGraph.VirtualNode n) {
    Location split = tBuilder.createLocation(name + "_" + this.mId + "_" + n.getId());
    split.setCommited();
    return SubAutomaton.singleton(split);
}
Also used : Location(com.jopdesign.wcet.uppaal.model.Location)

Aggregations

Location (com.jopdesign.wcet.uppaal.model.Location)6 Transition (com.jopdesign.wcet.uppaal.model.Transition)2 LayoutCFG (com.jopdesign.wcet.uppaal.model.LayoutCFG)1 TransitionAttributes (com.jopdesign.wcet.uppaal.model.TransitionAttributes)1 File (java.io.File)1 IOException (java.io.IOException)1