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());
}
}
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);
}
Aggregations