use of de.prob.model.eventb.MachineModifier in project prob2 by bendisposto.
the class ComponentExtractor method caseAMachineParseUnit.
@Override
public void caseAMachineParseUnit(final AMachineParseUnit node) {
String name = node.getName().getText();
MachineModifier machineM = new MachineModifier(new EventBMachine(name), typeEnv);
ModelElementList<Context> seen = new ModelElementList<>();
for (TIdentifierLiteral contextName : node.getSeenNames()) {
String cName = contextName.getText();
AbstractElement context = getContext(cName);
seen = seen.addElement((Context) context);
}
machineM = machineM.setSees(seen);
if (node.getRefinesNames().size() == 1) {
String mname = node.getRefinesNames().getFirst().getText();
EventBMachine machine = getMachine(mname);
machineM = machineM.setRefines(machine);
} else if (node.getRefinesNames().size() > 1) {
throw new IllegalArgumentException("Machines can only refine one abstract machine. Found " + node.getRefinesNames().size() + " refined machines");
}
machineM = machineM.addComment(getComment(node.getComments()));
MachineExtractor mE = new MachineExtractor(machineM, typeEnv);
node.apply(mE);
modelM = modelM.addMachine(mE.getMachine());
}
use of de.prob.model.eventb.MachineModifier in project prob2 by bendisposto.
the class MachineExtractor method caseAEvent.
@Override
public void caseAEvent(final AEvent node) {
EventExtractor eE = new EventExtractor(new Event(node.getName().getText(), EventType.ORDINARY, false), machineM.getMachine().getRefines(), typeEnv, getComment(node.getComments()));
node.apply(eE);
machineM = new MachineModifier(machineM.getMachine().addTo(BEvent.class, eE.getEvent()), typeEnv);
}
use of de.prob.model.eventb.MachineModifier in project prob2 by bendisposto.
the class MachineExtractor method caseAAlgorithm.
@Override
public void caseAAlgorithm(final AAlgorithm node) {
AlgorithmExtractor aE = new AlgorithmExtractor(typeEnv);
Block algorithm = aE.extract(node);
machineM = new MachineModifier(machineM.getMachine().addTo(Block.class, algorithm), typeEnv);
}
Aggregations