Search in sources :

Example 1 with ContextModifier

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

the class ComponentExtractor method caseAContextParseUnit.

@Override
public void caseAContextParseUnit(final AContextParseUnit node) {
    String name = node.getName().getText();
    ContextModifier contextM = new ContextModifier(new Context(name), typeEnv);
    if (node.getExtendsNames().size() == 1) {
        String cName = node.getExtendsNames().getFirst().getText();
        Context ctx = getContext(cName);
        contextM = contextM.setExtends(ctx);
    } else if (node.getExtendsNames().size() > 1) {
        throw new IllegalArgumentException("Contexts can only refine one abstract context. Found " + node.getExtendsNames().size() + " extended machines");
    }
    contextM = contextM.addComment(getComment(node.getComments()));
    ContextExtractor cE = new ContextExtractor(contextM, typeEnv);
    node.apply(cE);
    modelM = modelM.addContext(cE.getContext());
}
Also used : Context(de.prob.model.eventb.Context) ContextModifier(de.prob.model.eventb.ContextModifier)

Aggregations

Context (de.prob.model.eventb.Context)1 ContextModifier (de.prob.model.eventb.ContextModifier)1