/// <summary>
        /// Applies a criteria to the <paramref name="list"/> of
        /// fuzzy items using the given <paramref name="predicate"/>.
        /// </summary>
        /// <typeparam name="TItem">The type of item to test.</typeparam>
        /// <param name="list">The list of <see cref="IFuzzyItem{T}"/> instances that represent a single test case in a fuzzy search.</param>
        /// <param name="predicate">The condition that will be used to test the target item.</param>
        /// <param name="criteriaType">The <see cref="CriteriaType"/> to associate with the predicate.</param>
        public static void AddCriteria <TItem>(this IEnumerable <IFuzzyItem <TItem> > list, Func <TItem, bool> predicate,
                                               CriteriaType criteriaType)
        {
            const int defaultWeight = 1;

            list.AddCriteria(predicate, criteriaType, defaultWeight);
        }
        private void ShouldMatchPublicMethods(IEnumerable <IFuzzyItem <MethodInfo> > methods)
        {
            if (IsPublic == null)
            {
                return;
            }
            Func <MethodInfo, bool> isPublic = method => method.IsPublic == IsPublic;

            methods.AddCriteria(isPublic);
        }
        private void ShouldMatchProtectedMethods(IEnumerable <IFuzzyItem <MethodInfo> > methods)
        {
            if (IsProtected == null)
            {
                return;
            }

            Func <MethodInfo, bool> isProtectedMethod = method => method.IsFamily == IsProtected;

            methods.AddCriteria(isProtectedMethod);
        }
        /// <summary>
        /// Applies a criteria to the <paramref name="list"/> of
        /// fuzzy items using the given <paramref name="predicate"/>.
        /// </summary>
        /// <typeparam name="TItem">The type of item to test.</typeparam>
        /// <param name="list">The list of <see cref="IFuzzyItem{T}"/> instances that represent a single test case in a fuzzy search.</param>
        /// <param name="predicate">The condition that will be used to test the target item.</param>
        /// <param name="criteriaType">The <see cref="CriteriaType"/> to associate with the predicate.</param>
        /// <param name="weight">The weight of the predicate value expressed in the number of tests that will be counted for/against the target item as a result of the predicate.</param>
        public static void AddCriteria <TItem>(this IEnumerable <IFuzzyItem <TItem> > list, Func <TItem, bool> predicate, CriteriaType criteriaType, int weight)
        {
            var criteria = new Criteria <TItem>()
            {
                Predicate = predicate,
                Weight    = weight,
                Type      = criteriaType
            };

            list.AddCriteria(criteria);
        }
        private void ShouldMatchMethodName(IEnumerable <IFuzzyItem <MethodInfo> > methods)
        {
            if (string.IsNullOrEmpty(MethodName))
            {
                return;
            }

            Func <MethodInfo, bool> shouldMatchMethodName =
                method => method.Name == MethodName;

            // Results that match the method name will get a higher
            // score
            methods.AddCriteria(shouldMatchMethodName, CriteriaType.Critical);
        }
        private void ShouldMatchMethodName(IEnumerable<IFuzzyItem<MethodInfo>> methods)
        {
            if (string.IsNullOrEmpty(MethodName))
                return;

            Func<MethodInfo, bool> shouldMatchMethodName =
                method => method.Name == MethodName;

            // Results that match the method name will get a higher
            // score
            methods.AddCriteria(shouldMatchMethodName, CriteriaType.Critical);
        }
 private void ShouldMatchPublicMethods(IEnumerable<IFuzzyItem<MethodInfo>> methods)
 {
     if (IsPublic == null)
         return;
     Func<MethodInfo, bool> isPublic = method => method.IsPublic == IsPublic;
     methods.AddCriteria(isPublic);
 }
        private void ShouldMatchProtectedMethods(IEnumerable<IFuzzyItem<MethodInfo>> methods)
        {
            if (IsProtected == null)
                return;

            Func<MethodInfo, bool> isProtectedMethod = method => method.IsFamily == IsProtected;
            methods.AddCriteria(isProtectedMethod);
        }
 /// <summary>
 /// Applies a criteria to the <paramref name="list"/> of
 /// fuzzy items using the given <paramref name="predicate"/>.
 /// </summary>
 /// <typeparam name="TItem">The type of item to test.</typeparam>
 /// <param name="list">The list of <see cref="IFuzzyItem{T}"/> instances that represent a single test case in a fuzzy search.</param>
 /// <param name="predicate">The condition that will be used to test the target item.</param>
 public static void AddCriteria <TItem>(this IEnumerable <IFuzzyItem <TItem> > list, Func <TItem, bool> predicate)
 {
     list.AddCriteria(predicate, CriteriaType.Standard);
 }