CompareHashes() public static method

public static CompareHashes ( string lhs, string rhs ) : double
lhs string
rhs string
return double
示例#1
0
        public IEnumerable <Simular> FindSimular(string carId, string rulesSetId, string hashValue, double threshold, RulesSet set = null)
        {
            RulesSet.Rule[] workedRules = null;

            if (!_dictionary.ContainsKey(rulesSetId))
            {
                yield break;
            }

            foreach (var pair in _dictionary[rulesSetId])
            {
                if (pair.Key == carId)
                {
                    continue;
                }

                var value = set == null?RulesSet.CompareHashes(hashValue, pair.Value) : RulesSet.CompareHashes(hashValue, pair.Value, set, out workedRules);

                if (value > threshold)
                {
                    yield return(new Simular {
                        CarId = pair.Key, Value = value, WorkedRules = workedRules
                    });
                }
            }
        }
示例#2
0
        public IEnumerable <Simular> FindSimular([NotNull] string carId, [NotNull] string setId, [NotNull] byte[] hashValues, double threshold,
                                                 [NotNull] RulesSet set, bool keepWorkedRules)
        {
            var index = _setsKeys.IndexOf(setId);

            if (index < 0)
            {
                throw new Exception($"Set “{setId}” is not defined");
            }

            foreach (var pair in _dictionary)
            {
                if (pair.Key == carId)
                {
                    continue;
                }

                var pairHash = pair.Value[index];
                var value    = RulesSet.CompareHashes(hashValues, pairHash, set, keepWorkedRules, out var workedRules);
                if (value > threshold)
                {
                    yield return(new Simular {
                        CarId = pair.Key, Value = value, WorkedRules = workedRules
                    });
                }
            }
        }