use of edu.uiowa.cs.clc.kind2.lustre.ContractBuilder in project VERDICT by ge-high-assurance.
the class VDMLustre2Kind2 method visit.
/**
* Translate VDM model contract to Kind 2 Lustre contract.
*
* @param modelContract the VDM model contract
* @return the Kind 2 Lustre contract builder
*/
private static ContractBuilder visit(Contract modelContract) {
ContractBuilder cb = new ContractBuilder(modelContract.getName());
for (NodeParameter inputParam : modelContract.getInputParameter()) {
if (inputParam.isIsConstant() != null && inputParam.isIsConstant()) {
cb.createVarInput(inputParam.getName(), visit(inputParam.getDataType()));
} else {
cb.createConstInput(inputParam.getName(), visit(inputParam.getDataType()));
}
}
for (NodeParameter outputParam : modelContract.getOutputParameter()) {
cb.createVarOutput(outputParam.getName(), visit(outputParam.getDataType()));
}
cb.setContractBody(visit(modelContract.getSpecification().get(0)));
return cb;
}
Aggregations