use of jkind.api.results.CompositeAnalysisResult in project AGREE by loonwerks.
the class VerifyHandler method runJob.
@Override
protected IStatus runJob(Element root, IProgressMonitor monitor) {
EphemeralImplementationUtil implUtil = new EphemeralImplementationUtil(monitor);
// this flag is set by the rerun handler to prevent clearing the advice map
if (!calledFromRerun) {
rerunAdviceMap.clear();
}
calledFromRerun = false;
disableRerunHandler();
handlerService = getWindow().getService(IHandlerService.class);
try {
// Make sure the user selected a component implementation
ComponentImplementation ci = getComponentImplementation(root, implUtil);
SystemInstance si = getSysInstance(ci, implUtil);
AnalysisResult result;
CompositeAnalysisResult wrapper = new CompositeAnalysisResult("");
if (isRecursive()) {
if (AgreeUtils.usingKind2()) {
throw new AgreeException("Kind2 only supports monolithic verification");
}
result = buildAnalysisResult(ci.getName(), si);
wrapper.addChild(result);
result = wrapper;
} else if (isRealizability()) {
AgreeProgram agreeProgram = new AgreeASTBuilder().getAgreeProgram(si, false);
Program program = LustreAstBuilder.getRealizabilityLustreProgram(agreeProgram);
wrapper.addChild(createVerification("Realizability Check", si, program, agreeProgram, AnalysisType.Realizability));
result = wrapper;
} else {
CompositeAnalysisResult wrapperTop = new CompositeAnalysisResult("Verification for " + ci.getName());
wrapVerificationResult(si, wrapperTop);
wrapper.addChild(wrapperTop);
result = wrapper;
}
showView(result, linker);
return doAnalysis(ci, monitor);
} catch (Throwable e) {
String messages = getNestedMessages(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
} finally {
implUtil.cleanup();
}
}
use of jkind.api.results.CompositeAnalysisResult in project AGREE by loonwerks.
the class VerifyHandler method buildAnalysisResult.
protected AnalysisResult buildAnalysisResult(String name, ComponentInstance ci) {
CompositeAnalysisResult result = new CompositeAnalysisResult("Verification for " + name);
if (containsAGREEAnnex(ci)) {
wrapVerificationResult(ci, result);
ComponentImplementation compImpl = AgreeUtils.getInstanceImplementation(ci);
for (ComponentInstance subInst : ci.getComponentInstances()) {
if (AgreeUtils.getInstanceImplementation(subInst) != null) {
AnalysisResult buildAnalysisResult = buildAnalysisResult(subInst.getName(), subInst);
if (buildAnalysisResult != null) {
result.addChild(buildAnalysisResult);
}
}
}
if (result.getChildren().size() != 0) {
linker.setComponent(result, compImpl);
return result;
}
}
return null;
}
use of jkind.api.results.CompositeAnalysisResult in project AGREE by loonwerks.
the class VerifyHandler method clearView.
protected void clearView() {
getWindow().getShell().getDisplay().syncExec(() -> {
try {
TestCaseGeneratorResultsView page = (TestCaseGeneratorResultsView) getWindow().getActivePage().showView(TestCaseGeneratorResultsView.ID);
page.setInput(new CompositeAnalysisResult("empty"), null);
} catch (PartInitException e) {
e.printStackTrace();
}
});
}
use of jkind.api.results.CompositeAnalysisResult in project AMASE by loonwerks.
the class IvcToFTGenerator method generateFT.
public FaultTree generateFT(AnalysisResult result, AgreeResultsLinker linker) {
// initialize
MHSUtils.clearLocals();
// get current verification result
AnalysisResult curResult = ((CompositeAnalysisResult) result).getChildren().get(0);
walkthroughResults(curResult, null, linker);
// some node's child nodes were added before those child nodes obtained their own child nodes
// fix those discrepancies in the traverse
faultTree.updateChildNodes();
// sort through intermediate nodes to declare before use
faultTree.sortIntermediateNodes();
return faultTree;
}
use of jkind.api.results.CompositeAnalysisResult in project AMASE by loonwerks.
the class GenMCSHandler method runJob.
@Override
protected IStatus runJob(Element root, IProgressMonitor monitor) {
EphemeralImplementationUtil implUtil = new EphemeralImplementationUtil(monitor);
// this flag is set by the rerun handler to prevent clearing the advice map
if (!calledFromRerun) {
rerunAdviceMap.clear();
}
calledFromRerun = false;
disableRerunHandler();
handlerService = getWindow().getService(IHandlerService.class);
try {
// Make sure the user selected a component implementation
ComponentImplementation ci = getComponentImplementation(root, implUtil);
SystemInstance si = getSysInstance(ci, implUtil);
AnalysisResult result;
CompositeAnalysisResult wrapper = new CompositeAnalysisResult("");
// SystemType sysType = si.getSystemImplementation().getType();
ComponentType sysType = AgreeUtils.getInstanceType(si);
EList<AnnexSubclause> annexSubClauses = AnnexUtil.getAllAnnexSubclauses(sysType, AgreePackage.eINSTANCE.getAgreeContractSubclause());
if (annexSubClauses.size() == 0) {
throw new AgreeException("There is not an AGREE annex in the '" + sysType.getName() + "' system type.");
}
if (isRecursive()) {
if (AgreeUtils.usingKind2()) {
throw new AgreeException("Kind2 only supports monolithic verification");
}
result = buildAnalysisResult(((NamedElement) root).getName(), si);
wrapper.addChild(result);
result = wrapper;
} else if (isRealizability()) {
AgreeProgram agreeProgram = new AgreeASTBuilder().getAgreeProgram(si, false);
Program program = LustreAstBuilder.getRealizabilityLustreProgram(agreeProgram);
wrapper.addChild(createVerification("Realizability Check", si, program, agreeProgram, AnalysisType.Realizability));
result = wrapper;
} else {
wrapVerificationResult(si, wrapper);
result = wrapper;
}
showView(result, linker);
return doAnalysis(root, monitor, result, linker);
} catch (Throwable e) {
String messages = getNestedMessages(e);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
} finally {
implUtil.cleanup();
}
}
Aggregations