Search in sources :

Example 1 with FaultSetProbability

use of edu.umn.cs.crisys.safety.analysis.ast.visitors.AddFaultsToNodeVisitor.FaultSetProbability in project AMASE by loonwerks.

the class FTResolveVisitor method isSubset.

private boolean isSubset(FTNonLeafNode node, ArrayList<FaultSetProbability> faultCombinationsAboveThreshold) {
    boolean isSubset = false;
    HashSet<String> childNodeSet = new HashSet<String>();
    for (FTNode childNode : node.childNodes.values()) {
        if (!(childNode instanceof FTLeafNode)) {
            throw new SafetyException("Trying to prune node " + node.nodeName + " with non leaf child " + childNode.nodeName);
        } else {
            childNodeSet.add(((FTLeafNode) childNode).lustreFaultName);
        }
    }
    for (FaultSetProbability faultCombination : AddFaultsToNodeVisitor.faultCombinationsAboveThreshold) {
        HashSet<String> faultCombinationSet = faultCombination.toStringSet();
        if (faultCombinationSet.containsAll(childNodeSet)) {
            isSubset = true;
            return isSubset;
        }
    }
    return isSubset;
}
Also used : FTNode(edu.umn.cs.crisys.safety.analysis.faultTree.FTNode) SafetyException(edu.umn.cs.crisys.safety.analysis.SafetyException) FTLeafNode(edu.umn.cs.crisys.safety.analysis.faultTree.FTLeafNode) FaultSetProbability(edu.umn.cs.crisys.safety.analysis.ast.visitors.AddFaultsToNodeVisitor.FaultSetProbability) HashSet(java.util.HashSet)

Aggregations

SafetyException (edu.umn.cs.crisys.safety.analysis.SafetyException)1 FaultSetProbability (edu.umn.cs.crisys.safety.analysis.ast.visitors.AddFaultsToNodeVisitor.FaultSetProbability)1 FTLeafNode (edu.umn.cs.crisys.safety.analysis.faultTree.FTLeafNode)1 FTNode (edu.umn.cs.crisys.safety.analysis.faultTree.FTNode)1 HashSet (java.util.HashSet)1