<commit_before>﻿namespace Gu.Reactive
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Diagnostics.CodeAnalysis;
    using System.Linq;

    using Gu.Reactive.Internals;

    /// <summary>
    /// Helper for synchronizing two coillections and notifying about diffs.
    /// </summary>
    [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
    public class CollectionSynchronizer<T> : Collection<T>
    {
        private readonly List<T> temp = new List<T>();

        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionSynchronizer{T}"/> class.
        /// </summary>
        public CollectionSynchronizer(IEnumerable<T> source)
        {
            this.Reset(source ?? Enumerable.Empty<T>());
        }

        /// <summary>
        /// Returns the index of the last occurrence of a given value in a range of
        /// this list. The list is searched backwards, starting at the end
        /// and ending at the first element in the list. The elements of the list
        /// are compared to the given value using the Object.Equals method.
        ///
        /// This method uses the Array.LastIndexOf method to perform the
        /// search.
        /// </summary>
        public int LastIndexOf(T value)
        {
            return ((List<T>)this.Items).LastIndexOf(value);
        }

        /// <summary>
        /// Set this to <paramref name="updated"/> and notify about changes.
        /// </summary>
        /// <param name="updated">The updated collection.</param>
        public void Reset(IEnumerable<T> updated)
        {
            this.Refresh(updated, CachedEventArgs.EmptyArgs, null, null);
        }

        /// <summary>
        /// Set to <paramref name="updated"/> and notify about changes.
        /// </summary>
        /// <param name="updated">The updated collection.</param>
        /// <param name="propertyChanged">The <see cref="Action{PropertyChangedEventArgs}"/> to notify on.</param>
        /// <param name="collectionChanged">The <see cref="Action{NotifyCollectionChangedEventArgs}"/> to notify on.</param>
        public void Reset(IEnumerable<T> updated, Action<PropertyChangedEventArgs> propertyChanged, Action<NotifyCollectionChangedEventArgs> collectionChanged)
        {
            this.Refresh(updated, CachedEventArgs.EmptyArgs, propertyChanged, collectionChanged);
        }

        /// <summary>
        /// Set to <paramref name="updated"/> and notify about changes.
        /// </summary><commit_msg>Remove unused.<commit_after>﻿namespace Gu.Reactive
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Diagnostics.CodeAnalysis;
    using System.Linq;

    using Gu.Reactive.Internals;

    /// <summary>
    /// Helper for synchronizing two coillections and notifying about diffs.
    /// </summary>
    [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
    public class CollectionSynchronizer<T> : Collection<T>
    {
        private readonly List<T> temp = new List<T>();

        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionSynchronizer{T}"/> class.
        /// </summary>
        public CollectionSynchronizer(IEnumerable<T> source)
        {
            this.Reset(source ?? Enumerable.Empty<T>());
        }

        /// <summary>
        /// Set this to <paramref name="updated"/> and notify about changes.
        /// </summary>
        /// <param name="updated">The updated collection.</param>
        public void Reset(IEnumerable<T> updated)
        {
            this.Refresh(updated, CachedEventArgs.EmptyArgs, null, null);
        }

        /// <summary>
        /// Set to <paramref name="updated"/> and notify about changes.
        /// </summary>
        /// <param name="updated">The updated collection.</param>
        /// <param name="propertyChanged">The <see cref="Action{PropertyChangedEventArgs}"/> to notify on.</param>
        /// <param name="collectionChanged">The <see cref="Action{NotifyCollectionChangedEventArgs}"/> to notify on.</param>
        public void Reset(IEnumerable<T> updated, Action<PropertyChangedEventArgs> propertyChanged, Action<NotifyCollectionChangedEventArgs> collectionChanged)
        {
            this.Refresh(updated, CachedEventArgs.EmptyArgs, propertyChanged, collectionChanged);
        }

        /// <summary>
        /// Set to <paramref name="updated"/> and notify about changes.
        /// </summary>
{'fraction_non_alphanumeric': 0.12446808510638298, 'fraction_numerical': 0.0, 'mean_word_length': 2.464259395725866, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 0, '>': 74, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6981870', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1173, 'n_words': 328}