Search in sources :

Example 1 with PropertyResult

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);
                }
            });
        }
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) TcgExtractorRegistry(com.rockwellcollins.atc.tcg.extensions.TcgExtractorRegistry) TcgExtractor(com.rockwellcollins.atc.tcg.extensions.TcgExtractor) Counterexample(jkind.results.Counterexample) PropertyResult(jkind.api.results.PropertyResult) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming) Renaming(jkind.api.results.Renaming) Layout(jkind.results.layout.Layout) EObject(org.eclipse.emf.ecore.EObject) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming)

Example 2 with PropertyResult

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));
            }
        }
    }
}
Also used : GuaranteeStatement(com.rockwellcollins.atc.agree.agree.GuaranteeStatement) AssumeStatement(com.rockwellcollins.atc.agree.agree.AssumeStatement) EObject(org.eclipse.emf.ecore.EObject) CallExpr(com.rockwellcollins.atc.agree.agree.CallExpr) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming) LemmaStatement(com.rockwellcollins.atc.agree.agree.LemmaStatement) PropertyResult(jkind.api.results.PropertyResult)

Example 3 with PropertyResult

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);
            }
        });
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) ValidProperty(jkind.results.ValidProperty) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) PropertyResult(jkind.api.results.PropertyResult) JKindResult(jkind.api.results.JKindResult) HashSet(java.util.HashSet)

Example 4 with PropertyResult

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);
            }
        }
    }
}
Also used : ValidProperty(jkind.results.ValidProperty) PropertyResult(jkind.api.results.PropertyResult)

Example 5 with PropertyResult

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());
}
Also used : ValidProperty(jkind.results.ValidProperty) PropertyResult(jkind.api.results.PropertyResult) HashSet(java.util.HashSet)

Aggregations

PropertyResult (jkind.api.results.PropertyResult)14 ValidProperty (jkind.results.ValidProperty)6 JKindResult (jkind.api.results.JKindResult)5 EObject (org.eclipse.emf.ecore.EObject)4 GuaranteeStatement (com.rockwellcollins.atc.agree.agree.GuaranteeStatement)3 ArrayList (java.util.ArrayList)3 InvalidProperty (jkind.results.InvalidProperty)3 AssumeStatement (com.rockwellcollins.atc.agree.agree.AssumeStatement)2 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)2 LemmaStatement (com.rockwellcollins.atc.agree.agree.LemmaStatement)2 AgreeRenaming (com.rockwellcollins.atc.agree.analysis.AgreeRenaming)2 TcgRenaming (com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Renaming (jkind.api.results.Renaming)2 Counterexample (jkind.results.Counterexample)2 Action (org.eclipse.jface.action.Action)2 IAction (org.eclipse.jface.action.IAction)2 MessageConsoleStream (org.eclipse.ui.console.MessageConsoleStream)2 AgreeException (com.rockwellcollins.atc.agree.analysis.AgreeException)1