use of de.be4.classicalb.core.parser.node.PContextClause in project prob2 by bendisposto.
the class ContextTranslator method processAxiomsAndTheorems.
private List<PContextClause> processAxiomsAndTheorems() {
List<PContextClause> axiomsAndThms = new ArrayList<>();
List<PPredicate> axioms = new ArrayList<>();
List<PPredicate> thms = new ArrayList<>();
for (EventBAxiom axiom : context.getAxioms()) {
PPredicate ppred = (PPredicate) ((EventB) axiom.getPredicate()).getAst();
nodeInfos.put(ppred, new Tuple2<>(context.getName(), axiom.getName()));
if (axiom.isTheorem()) {
thms.add(ppred);
} else {
axioms.add(ppred);
}
}
axiomsAndThms.add(new AAxiomsContextClause(axioms));
axiomsAndThms.add(new ATheoremsContextClause(thms));
return axiomsAndThms;
}
use of de.be4.classicalb.core.parser.node.PContextClause 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.be4.classicalb.core.parser.node.PContextClause in project prob2 by bendisposto.
the class ContextTranslator method translateContext.
public Node translateContext() {
AEventBContextParseUnit ast = new AEventBContextParseUnit();
ast.setName(new TIdentifierLiteral(context.getName()));
List<PContextClause> clauses = new ArrayList<>();
clauses.add(processExtends());
clauses.addAll(processConstants());
clauses.addAll(processAxiomsAndTheorems());
clauses.add(processSets());
ast.setContextClauses(clauses);
return ast;
}
Aggregations