public bool IsMatchExcluded(MprFeatureSet mprFeats, out MprFeatureGroup mismatchGroup) { foreach (IGrouping <MprFeatureGroup, MprFeature> group in this.GroupBy(mf => mf.Group)) { if (group.Key == null || group.Key.MatchType == MprFeatureGroupMatchType.All) { if (group.Any(mf => mprFeats.Contains(mf))) { mismatchGroup = group.Key; return(false); } } else { if (group.All(mf => mprFeats.Contains(mf))) { mismatchGroup = group.Key; return(false); } } } mismatchGroup = null; return(true); }
private static XElement CreateMprFeaturesFailureElement(bool required, MprFeatureGroup group, MprFeatureSet feats, Word input) { return new XElement("FailureReason", new XAttribute("type", "mprFeatures"), new XElement("MatchType", required ? "required" : "excluded"), new XElement("Group", group), new XElement("MprFeatures", input.MprFeatures.Where(mf => mf.Group == group).Select(f => new XElement("MprFeature", f))), new XElement("ConstrainingMprFeatrues", feats.Where(mf => mf.Group == group).Select(f => new XElement("MprFeature", f)))); }
private void LoadMprFeatGroup(XElement mprFeatGroupElem) { var group = new MprFeatureGroup { Name = (string) mprFeatGroupElem.Element("Name") }; group.MatchType = GetGroupMatchType((string) mprFeatGroupElem.Attribute("matchType")); group.Output = GetGroupOutput((string) mprFeatGroupElem.Attribute("outputType")); var mprFeatIdsStr = (string) mprFeatGroupElem.Attribute("features"); foreach (MprFeature mprFeat in LoadMprFeatures(mprFeatIdsStr)) group.MprFeatures.Add(mprFeat); _language.MprFeatureGroups.Add(group); }