use of jkind.api.results.PropertyResult in project AGREE by loonwerks.
the class TestCaseGeneratorMenuListener method addViewTestCaseMenu.
private void addViewTestCaseMenu(IMenuManager manager, AnalysisResult result) {
final Counterexample cex = getCounterexample(result);
TcgExtractorRegistry tcgReg = (TcgExtractorRegistry) ExtensionRegistry.getRegistry(ExtensionRegistry.TCG_EXTRACTOR_EXT_ID);
List<TcgExtractor> extractors = tcgReg.getTcgExtractors();
if (cex != null) {
final String cexType = getCounterexampleType(result);
final Layout layout = linker.getLayout(result.getParent());
final Renaming renaming = linker.getRenaming(result.getParent());
final Map<String, EObject> refMap = ((TcgRenaming) renaming).getTcgRefMap();
final Counterexample translatedCex = AgreeMenuListener.translateCounterexampleArrayIndices(cex);
MenuManager sub = new MenuManager("View " + cexType + "Test Case in");
manager.add(sub);
sub.add(new Action("Console") {
@Override
public void run() {
viewCexConsole(translatedCex, layout, refMap, (TcgRenaming) renaming);
}
});
sub.add(new Action("Eclipse") {
@Override
public void run() {
viewCexEclipse(translatedCex, layout, refMap);
}
});
sub.add(new Action("Spreadsheet") {
@Override
public void run() {
viewCexSpreadsheet(translatedCex, layout);
}
});
// send counterexamples to external plugins
PropertyResult pr = (PropertyResult) result;
EObject property = refMap.get(pr.getName());
ComponentImplementation compImpl = linker.getComponent(result.getParent());
for (TcgExtractor ex : extractors) {
sub.add(new Action(ex.getDisplayText()) {
@Override
public void run() {
ex.receiveCex(compImpl, property, translatedCex, refMap);
}
});
}
}
}
use of jkind.api.results.PropertyResult in project AGREE by loonwerks.
the class TestCaseGeneratorMenuListener method addResultsLinkingMenu.
private void addResultsLinkingMenu(IMenuManager manager, AnalysisResult result) {
if (result instanceof PropertyResult) {
PropertyResult pr = (PropertyResult) result;
Map<String, EObject> refMap = ((TcgRenaming) linker.getRenaming(result.getParent())).getTcgRefMap();
if (refMap != null) {
EObject property = refMap.get(pr.getName());
if (property instanceof GuaranteeStatement) {
manager.add(createHyperlinkAction("Go To Guarantee", property));
}
if (property instanceof LemmaStatement) {
manager.add(createHyperlinkAction("Go To Lemma", property));
}
if (property instanceof AssumeStatement) {
manager.add(createHyperlinkAction("Go To Assumption", property));
}
if (property instanceof CallExpr) {
manager.add(createHyperlinkAction("Go To Node Call", property));
}
}
}
}
use of jkind.api.results.PropertyResult in project AGREE by loonwerks.
the class AgreeMenuListener method addTraceabilityMatrixMenu.
private void addTraceabilityMatrixMenu(IMenuManager manager, AnalysisResult result) {
IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
if (prefs.getString(PreferenceConstants.PREF_MODEL_CHECKER).equals(PreferenceConstants.MODEL_CHECKER_JKIND) && prefs.getBoolean(PreferenceConstants.PREF_SUPPORT) && result instanceof JKindResult) {
JKindResult jresult = (JKindResult) result;
Set<String> reqs = new HashSet<String>();
for (PropertyResult pr : jresult.getPropertyResults()) {
if (pr.getProperty() instanceof ValidProperty) {
ValidProperty vp = (ValidProperty) pr.getProperty();
Set<String> ivc = vp.getIvc();
if (ivc != null && !ivc.isEmpty()) {
reqs.addAll(ivc);
}
}
}
String nodeName = linker.getComponent(result).getName();
manager.add(new Action("View traceability matrix for " + nodeName) {
@Override
public void run() {
viewTraceabilityMatrix(jresult, reqs);
}
});
}
}
use of jkind.api.results.PropertyResult in project AGREE by loonwerks.
the class AgreeTraceabilityMatrixView method createContent.
private void createContent(JKindResult result, List<String> raw) {
for (PropertyResult pr : result.getPropertyResults()) {
if (pr.getProperty() instanceof ValidProperty) {
ValidProperty vp = (ValidProperty) pr.getProperty();
Set<String> ivc = vp.getIvc();
if (ivc != null && !ivc.isEmpty()) {
createRow(vp.getName(), ivc, raw);
}
}
}
}
use of jkind.api.results.PropertyResult in project AGREE by loonwerks.
the class AgreeTraceabilityMatrixView method usedCandidates.
public List<String> usedCandidates(JKindResult result) {
Set<String> reqs = new HashSet<>();
for (PropertyResult pr : result.getPropertyResults()) {
if (pr.getProperty() instanceof ValidProperty) {
ValidProperty vp = (ValidProperty) pr.getProperty();
Set<String> ivc = vp.getIvc();
if (ivc != null && !ivc.isEmpty()) {
reqs.addAll(ivc);
}
}
}
return reqs.stream().collect(Collectors.toList());
}
Aggregations