Search in sources :

Example 1 with ContractBuilder

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;
}
Also used : ContractBuilder(edu.uiowa.cs.clc.kind2.lustre.ContractBuilder) NodeParameter(verdict.vdm.vdm_lustre.NodeParameter)

Aggregations

ContractBuilder (edu.uiowa.cs.clc.kind2.lustre.ContractBuilder)1 NodeParameter (verdict.vdm.vdm_lustre.NodeParameter)1