Search in sources :

Example 1 with EventBVariable

use of de.prob.model.eventb.EventBVariable in project prob2 by bendisposto.

the class EventBModelTranslator method printPragmas.

private void printPragmas(final IPrologTermOutput pto) {
    for (Machine machine : model.getChildrenOfType(Machine.class)) {
        EventBMachine ebM = (EventBMachine) machine;
        for (EventBVariable var : ebM.getVariables()) {
            if (var.hasUnit()) {
                pto.openTerm("pragma");
                pto.printAtom("unit");
                pto.printAtom(machine.getName());
                pto.printAtom(var.getName());
                pto.openList();
                pto.printAtom(var.getUnit());
                pto.closeList();
                pto.closeTerm();
            }
        }
    }
    for (Context context : model.getChildrenOfType(Context.class)) {
        for (EventBConstant constant : context.getConstants()) {
            if (constant.hasUnit()) {
                pto.openTerm("pragma");
                pto.printAtom("unit");
                pto.printAtom(context.getName());
                pto.printAtom(constant.getName());
                pto.openList();
                pto.printAtom(constant.getUnit());
                pto.closeList();
                pto.closeTerm();
            }
        }
    }
}
Also used : Context(de.prob.model.eventb.Context) EventBVariable(de.prob.model.eventb.EventBVariable) EventBConstant(de.prob.model.eventb.EventBConstant) EventBMachine(de.prob.model.eventb.EventBMachine) EventBMachine(de.prob.model.eventb.EventBMachine) Machine(de.prob.model.representation.Machine)

Example 2 with EventBVariable

use of de.prob.model.eventb.EventBVariable in project prob2 by bendisposto.

the class MachineXmlHandler method addVariable.

private void addVariable(final Attributes attributes) {
    String name = attributes.getValue("name");
    boolean concrete = "true".equals(attributes.getValue("org.eventb.core.concrete"));
    String unit = attributes.getValue("de.prob.units.unitPragmaAttribute");
    if (concrete) {
        variables.add(new EventBVariable(name, unit));
    }
}
Also used : EventBVariable(de.prob.model.eventb.EventBVariable)

Aggregations

EventBVariable (de.prob.model.eventb.EventBVariable)2 Context (de.prob.model.eventb.Context)1 EventBConstant (de.prob.model.eventb.EventBConstant)1 EventBMachine (de.prob.model.eventb.EventBMachine)1 Machine (de.prob.model.representation.Machine)1