Search in sources :

Example 11 with SpecStatement

use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AMASE by loonwerks.

the class SafetyAnnexContentAssist method getNestedDotIDCandidates.

private List<String> getNestedDotIDCandidates(AadlPackage aadlPackage) {
    AgreeContract contract = null;
    List<String> results = new ArrayList<>();
    for (AnnexLibrary annex : AnnexUtil.getAllActualAnnexLibraries(aadlPackage, AgreePackage.eINSTANCE.getAgreeContractLibrary())) {
        if (annex instanceof AgreeLibrary) {
            contract = (AgreeContract) ((AgreeContractLibrary) annex).getContract();
        }
    }
    if (contract != null) {
        for (SpecStatement spec : contract.getSpecs()) {
            if (spec instanceof ConstStatement) {
                results.add(((ConstStatement) spec).getName());
            }
        }
    }
    return results;
}
Also used : AgreeContract(com.rockwellcollins.atc.agree.agree.AgreeContract) ConstStatement(com.rockwellcollins.atc.agree.agree.ConstStatement) AgreeLibrary(com.rockwellcollins.atc.agree.agree.AgreeLibrary) AgreeContractLibrary(com.rockwellcollins.atc.agree.agree.AgreeContractLibrary) ArrayList(java.util.ArrayList) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) AnnexLibrary(org.osate.aadl2.AnnexLibrary)

Example 12 with SpecStatement

use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AMASE by loonwerks.

the class SafetyScopeProvider method getNamedElementsFromSpecs.

private Set<NamedElement> getNamedElementsFromSpecs(EList<SpecStatement> agreeSpecs) {
    Set<NamedElement> nelms = new HashSet<>();
    for (SpecStatement spec : agreeSpecs) {
        if (spec instanceof NamedElement) {
            nelms.add((NamedElement) spec);
        }
        if (spec instanceof EqStatement) {
            EqStatement eq = (EqStatement) spec;
            nelms.addAll(eq.getLhs());
        } else if (spec instanceof InputStatement) {
            nelms.addAll(((InputStatement) spec).getLhs());
        } else if (spec instanceof EnumStatement) {
            nelms.addAll(((EnumStatement) spec).getEnums());
        }
    }
    return nelms;
}
Also used : EnumStatement(com.rockwellcollins.atc.agree.agree.EnumStatement) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) SafetyEqStatement(edu.umn.cs.crisys.safety.safety.SafetyEqStatement) EqStatement(com.rockwellcollins.atc.agree.agree.EqStatement) InputStatement(com.rockwellcollins.atc.agree.agree.InputStatement) NamedElement(org.osate.aadl2.NamedElement) HashSet(java.util.HashSet)

Example 13 with SpecStatement

use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AMASE by loonwerks.

the class SafetyScopeProvider method getNamedElementsFromSafetySpecs.

private Set<NamedElement> getNamedElementsFromSafetySpecs(EList<edu.umn.cs.crisys.safety.safety.SpecStatement> safetySpecs) {
    Set<NamedElement> nelms = new HashSet<>();
    EList<FaultSubcomponent> faultDefs = null;
    for (SpecStatement spec : safetySpecs) {
        if (spec instanceof FaultStatement) {
            FaultStatement fs = (FaultStatement) spec;
            faultDefs = fs.getFaultDefinitions();
            for (FaultSubcomponent fsub : faultDefs) {
                if (fsub instanceof SafetyEqStatement) {
                    SafetyEqStatement seq = (SafetyEqStatement) fsub;
                    if (seq instanceof EqValue) {
                        EqValue eqVal = (EqValue) seq;
                        nelms.addAll(eqVal.getLhs());
                    } else if (seq instanceof IntervalEq) {
                        IntervalEq eqVal = (IntervalEq) seq;
                        nelms.add(eqVal.getLhs_int());
                    }
                }
            }
        // nelms.add((NamedElement) spec);
        }
    }
    return nelms;
}
Also used : SafetyEqStatement(edu.umn.cs.crisys.safety.safety.SafetyEqStatement) FaultSubcomponent(edu.umn.cs.crisys.safety.safety.FaultSubcomponent) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) FaultStatement(edu.umn.cs.crisys.safety.safety.FaultStatement) IntervalEq(edu.umn.cs.crisys.safety.safety.IntervalEq) NamedElement(org.osate.aadl2.NamedElement) EqValue(edu.umn.cs.crisys.safety.safety.EqValue) HashSet(java.util.HashSet)

Example 14 with SpecStatement

use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AGREE by loonwerks.

the class AgreeAnnexContentAssist method getNestedDotIDCandidates.

private List<String> getNestedDotIDCandidates(AadlPackage aadlPackage) {
    AgreeContract contract = null;
    List<String> results = new ArrayList<>();
    for (AnnexLibrary annex : AnnexUtil.getAllActualAnnexLibraries(aadlPackage, AgreePackage.eINSTANCE.getAgreeContractLibrary())) {
        if (annex instanceof AgreeLibrary) {
            contract = (AgreeContract) ((AgreeContractLibrary) annex).getContract();
        }
    }
    if (contract != null) {
        for (SpecStatement spec : contract.getSpecs()) {
            if (spec instanceof ConstStatement) {
                results.add(((ConstStatement) spec).getName());
            }
        }
    }
    return results;
}
Also used : AgreeContract(com.rockwellcollins.atc.agree.agree.AgreeContract) ConstStatement(com.rockwellcollins.atc.agree.agree.ConstStatement) AgreeLibrary(com.rockwellcollins.atc.agree.agree.AgreeLibrary) AgreeContractLibrary(com.rockwellcollins.atc.agree.agree.AgreeContractLibrary) ArrayList(java.util.ArrayList) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) AnnexLibrary(org.osate.aadl2.AnnexLibrary)

Example 15 with SpecStatement

use of com.rockwellcollins.atc.agree.agree.SpecStatement in project AGREE by loonwerks.

the class AgreeASTBuilder method getReachableStatements.

private List<AgreeStatement> getReachableStatements(EList<SpecStatement> specs, Map<String, jkind.lustre.Expr> rewriteMap) {
    List<AgreeStatement> reachables = new ArrayList<>();
    for (SpecStatement spec : specs) {
        if (spec instanceof ReachableStatement) {
            ReachableStatement reachable = (ReachableStatement) spec;
            if (reachable.getExpr() != null) {
                reachables.add(new AgreeStatement(reachable.getStr(), new jkind.lustre.UnaryExpr(jkind.lustre.UnaryOp.NOT, doSwitch(reachable.getExpr()).accept(new SubstitutionVisitor(rewriteMap))), spec));
            } else {
                PatternStatement pattern = reachable.getPattern();
                AgreeStatement patStatement = new AgreePatternBuilder(reachable.getStr(), reachable, this).doSwitch(pattern);
                patStatement.expr = new jkind.lustre.UnaryExpr(jkind.lustre.UnaryOp.NOT, patStatement.expr.accept(new SubstitutionVisitor(rewriteMap)));
                reachables.add(patStatement);
            }
        }
    }
    return reachables;
}
Also used : SubstitutionVisitor(jkind.translation.SubstitutionVisitor) PatternStatement(com.rockwellcollins.atc.agree.agree.PatternStatement) ArrayList(java.util.ArrayList) UnaryExpr(jkind.lustre.UnaryExpr) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) AgreePatternBuilder(com.rockwellcollins.atc.agree.analysis.realtime.AgreePatternBuilder) UnaryExpr(jkind.lustre.UnaryExpr) ReachableStatement(com.rockwellcollins.atc.agree.agree.ReachableStatement)

Aggregations

SpecStatement (com.rockwellcollins.atc.agree.agree.SpecStatement)25 ArrayList (java.util.ArrayList)17 AgreeContract (com.rockwellcollins.atc.agree.agree.AgreeContract)9 ConstStatement (com.rockwellcollins.atc.agree.agree.ConstStatement)8 EqStatement (com.rockwellcollins.atc.agree.agree.EqStatement)8 ArrayLiteralExpr (com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr)7 ArraySubExpr (com.rockwellcollins.atc.agree.agree.ArraySubExpr)7 ArrayUpdateExpr (com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr)7 BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)7 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)7 EnumLitExpr (com.rockwellcollins.atc.agree.agree.EnumLitExpr)7 EventExpr (com.rockwellcollins.atc.agree.agree.EventExpr)7 ExistsExpr (com.rockwellcollins.atc.agree.agree.ExistsExpr)7 FlatmapExpr (com.rockwellcollins.atc.agree.agree.FlatmapExpr)7 FoldLeftExpr (com.rockwellcollins.atc.agree.agree.FoldLeftExpr)7 FoldRightExpr (com.rockwellcollins.atc.agree.agree.FoldRightExpr)7 ForallExpr (com.rockwellcollins.atc.agree.agree.ForallExpr)7 GetPropertyExpr (com.rockwellcollins.atc.agree.agree.GetPropertyExpr)7 IndicesExpr (com.rockwellcollins.atc.agree.agree.IndicesExpr)7 IntLitExpr (com.rockwellcollins.atc.agree.agree.IntLitExpr)7