/// <summary> /// Compare two TrustMaps to determine how many of the found values per property matched, /// to incorporate that into trust scoring. /// </summary> /// <param name="otherRunMap">TrustMap for the other Run we're baselining against</param> public void CountMatchesWith(TrustMap otherRunMap) { foreach (TrustKey key in _map.Keys) { int matchCount = 0; TrustValue ourValue = _map[key]; if (otherRunMap._map.TryGetValue(key, out TrustValue theirValue)) { foreach (string value in ourValue.UniqueValues) { if (theirValue.UniqueValues.Contains(value)) { matchCount++; } } theirValue.MatchCount = matchCount; } ourValue.MatchCount = matchCount; } this.WasMatched = true; otherRunMap.WasMatched = true; }
/// <summary> /// Add a Result attribute to the map. /// </summary> /// <param name="component">WhatComponent for a Result attribute used in baselining</param> public void Add(WhatComponent component) { TrustKey key = new TrustKey(component); TrustValue value = null; if (!_map.TryGetValue(key, out value)) { value = new TrustValue(); _map[key] = value; } value.Add(component); }