Search in sources :

Example 26 with ComponentType

use of verdict.vdm.vdm_model.ComponentType in project VERDICT by ge-high-assurance.

the class Vdm2Csv method processComponentTypes.

private void processComponentTypes(List<ComponentType> compTypes, Table eventsTable, Table compDepTable, Table compSafTable) {
    // each ComponentType contains id, name, compCateg, List<Port>, ContractSpec, List<CyberRel>, List<SafetyRel>, List<Event>
    for (ComponentType compType : compTypes) {
        String compTypeName = compType.getName();
        String compQualName = compType.getId();
        String packageName = compQualName.substring(0, compQualName.indexOf(':'));
        // populate compTypeNameToEvents,  compTypeNameToCyberRels, compTypeNameToSafetyRels
        updateEventsTable(eventsTable, compQualName, packageName, compTypeName, compType.getEvent());
        updateCompDepTable(compDepTable, compQualName, packageName, compTypeName, compType.getCyberRel());
        updateCompSafTable(compSafTable, compQualName, packageName, compTypeName, compType.getSafetyRel());
    }
}
Also used : ComponentType(verdict.vdm.vdm_model.ComponentType)

Example 27 with ComponentType

use of verdict.vdm.vdm_model.ComponentType in project VERDICT by ge-high-assurance.

the class VerdictTestInstrumentor method instrumentTests.

/**
 * Produce one affirmative and one negated guarantee for every cyber requirement in the
 * top-level system of the model.
 */
public void instrumentTests() {
    ComponentType topLevel = getTopLevelSystemType();
    List<ContractItem> guarantees = topLevel.getContract().getGuarantee();
    List<ContractItem> replaceWith = new ArrayList<>();
    for (ContractItem guarantee : guarantees) {
        String name = guarantee.getName();
        // Build negated expression
        Expression negExpr = new Expression();
        negExpr.setNot(guarantee.getExpression());
        ContractItem pos = new ContractItem();
        pos.setExpression(guarantee.getExpression());
        pos.setName("pos_" + name);
        ContractItem neg = new ContractItem();
        neg.setExpression(negExpr);
        neg.setName("neg_" + name);
        replaceWith.add(pos);
        replaceWith.add(neg);
    }
    // Remove old guarantees and use our own
    guarantees.clear();
    guarantees.addAll(replaceWith);
}
Also used : ComponentType(verdict.vdm.vdm_model.ComponentType) ContractItem(verdict.vdm.vdm_lustre.ContractItem) Expression(verdict.vdm.vdm_lustre.Expression) ArrayList(java.util.ArrayList)

Aggregations

ComponentType (verdict.vdm.vdm_model.ComponentType)27 ComponentImpl (verdict.vdm.vdm_model.ComponentImpl)24 ComponentInstance (verdict.vdm.vdm_model.ComponentInstance)21 BlockImpl (verdict.vdm.vdm_model.BlockImpl)16 HashSet (java.util.HashSet)9 CompInstancePort (verdict.vdm.vdm_model.CompInstancePort)9 Port (verdict.vdm.vdm_model.Port)9 GenericAttribute (verdict.vdm.vdm_data.GenericAttribute)6 Expression (verdict.vdm.vdm_lustre.Expression)5 Connection (verdict.vdm.vdm_model.Connection)5 ConnectionEnd (verdict.vdm.vdm_model.ConnectionEnd)5 ContractItem (verdict.vdm.vdm_lustre.ContractItem)4 ArrayList (java.util.ArrayList)3 ConstantDeclaration (verdict.vdm.vdm_lustre.ConstantDeclaration)3 NodeBody (verdict.vdm.vdm_lustre.NodeBody)3 NodeEquation (verdict.vdm.vdm_lustre.NodeEquation)3 PortMode (verdict.vdm.vdm_model.PortMode)3 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 ContractSpec (verdict.vdm.vdm_lustre.ContractSpec)2