Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StringAlignmentFilter"/> class.
 /// </summary>
 public StringAlignmentFilter()
 {
     _DiffPredicate = delegate(string value1, string value2, IEnumerable <DiffChange> diff)
     {
         int same = diff.Where(s => s.Equal).Sum(s => s.Length1);
         return(((same * 2.0) / (value1.Length + value2.Length + 0.0)) >= 0.1);
     };
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StringAlignmentFilter"/> class.
        /// </summary>
        /// <param name="diffPredicate">
        /// The diff predicate used to determine if the strings are
        /// similar enough (see <see cref="StringSimilarityFilterPredicate"/> for details.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="diffPredicate" /> is <c>null</c>.</exception>
        public StringAlignmentFilter(StringSimilarityFilterPredicate diffPredicate)
        {
            if (diffPredicate == null)
            {
                throw new ArgumentNullException("diffPredicate");
            }

            _DiffPredicate = diffPredicate;
        }