/// <summary> /// Removes all invalid sets from <paramref name="sets" /> that conflict with either <paramref name="suppressedFaults" /> or /// <paramref name="forcedFaults" />. /// </summary> private static HashSet <FaultSet> RemoveInvalidSets(HashSet <FaultSet> sets, FaultSet suppressedFaults, FaultSet forcedFaults, HashSet <FaultSet> safeSets) { var validSets = new HashSet <FaultSet>(); foreach (var set in sets) { // The set must contain all forced faults, hence it must be a superset of those if (!forcedFaults.IsSubsetOf(set)) { safeSets.Add(set); continue; } // The set is not allowed to contain any suppressed faults, hence the intersection must be empty if (!suppressedFaults.GetIntersection(set).IsEmpty) { safeSets.Add(set); continue; } validSets.Add(set); } return(validSets); }
private bool IsValid(FaultSet set) { // The set must contain all forced faults, hence it must be a superset of those // The set is not allowed to contain any suppressed faults, hence the intersection must be empty return(_forcedSet.IsSubsetOf(set) && _suppressedSet.GetIntersection(set).IsEmpty); }