Search in sources :

Example 1 with SafetyEqStatement

use of edu.umn.cs.crisys.safety.safety.SafetyEqStatement 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)

Aggregations

SpecStatement (com.rockwellcollins.atc.agree.agree.SpecStatement)1 EqValue (edu.umn.cs.crisys.safety.safety.EqValue)1 FaultStatement (edu.umn.cs.crisys.safety.safety.FaultStatement)1 FaultSubcomponent (edu.umn.cs.crisys.safety.safety.FaultSubcomponent)1 IntervalEq (edu.umn.cs.crisys.safety.safety.IntervalEq)1 SafetyEqStatement (edu.umn.cs.crisys.safety.safety.SafetyEqStatement)1 HashSet (java.util.HashSet)1 NamedElement (org.osate.aadl2.NamedElement)1