use of de.prob.model.eventb.EventBConstant 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();
}
}
}
}
use of de.prob.model.eventb.EventBConstant in project prob2 by bendisposto.
the class ContextTranslator method processConstants.
private List<PContextClause> processConstants() {
List<PContextClause> constants = new ArrayList<>();
List<PExpression> concrete = new ArrayList<>();
List<PExpression> abstractC = new ArrayList<>();
for (EventBConstant eventBConstant : context.getConstants()) {
if (eventBConstant.isAbstract()) {
abstractC.add((PExpression) ((EventB) eventBConstant.getExpression()).getAst());
} else {
concrete.add((PExpression) ((EventB) eventBConstant.getExpression()).getAst());
}
}
constants.add(new AConstantsContextClause(concrete));
constants.add(new AAbstractConstantsContextClause(abstractC));
return constants;
}
use of de.prob.model.eventb.EventBConstant in project prob2 by bendisposto.
the class ContextXmlHandler method addConstant.
private void addConstant(final Attributes attributes) {
String name = attributes.getValue("name");
boolean symbolic = "true".equals(attributes.getValue("de.prob.symbolic.symbolicAttribute"));
String unit = attributes.getValue("de.prob.units.unitPragmaAttribute");
if (inInternalContext) {
internalConstants.add(new EventBConstant(name, symbolic, unit));
} else {
constants.add(new EventBConstant(name, symbolic, unit));
}
}
use of de.prob.model.eventb.EventBConstant in project prob2 by bendisposto.
the class MachineXmlHandler method addConstant.
private void addConstant(final Attributes attributes) {
String name = attributes.getValue("name");
boolean symbolic = "true".equals(attributes.getValue("de.prob.symbolic.symbolicAttribute"));
String unit = attributes.getValue("de.prob.units.unitPragmaAttribute");
constants.add(new EventBConstant(name, symbolic, unit));
}
Aggregations