<commit_before>﻿using AutoMapper.Configuration;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace AutoMapper.Features
{
    public class Features<TValue> : IEnumerable<TValue>
    {
        private IDictionary<Type, TValue> _features = new Dictionary<Type, TValue>();

        /// <summary>
        /// Gets the feature of type <typeparamref name="TFeature"/>.
        /// </summary>
        /// <typeparam name="TFeature">The type of the feature.</typeparam>
        /// <returns>The feature or null if feature not exists.</returns>
        public TFeature Get<TFeature>() where TFeature : TValue => (TFeature)_features.GetOrDefault(typeof(TFeature));

        /// <summary>
        /// Add or update the feature. Existing feature of the same type will be replaced.
        /// </summary>
        /// <param name="feature">The feature.</param>
        public void AddOrUpdate(TValue feature) => _features[feature.GetType()] = feature;

        public IEnumerator<TValue> GetEnumerator() => _features.Values.GetEnumerator();

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

        protected void MakeReadOnly() => _features = new ReadOnlyDictionary<Type, TValue>(_features);

        public void ForAll(Action<TValue> action)
        {
            foreach (var feature in this)
            {
                action(feature);
            }
        }
    }
}<commit_msg>rename<commit_after>﻿using AutoMapper.Configuration;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace AutoMapper.Features
{
    public class Features<TFeature> : IEnumerable<TFeature>
    {
        private IDictionary<Type, TFeature> _features = new Dictionary<Type, TFeature>();

        /// <summary>
        /// Gets the feature of type <typeparamref name="TFeatureToFind"/>.
        /// </summary>
        /// <typeparam name="TFeatureToFind">The type of the feature.</typeparam>
        /// <returns>The feature or null if feature not exists.</returns>
        public TFeatureToFind Get<TFeatureToFind>() where TFeatureToFind : TFeature => (TFeatureToFind)_features.GetOrDefault(typeof(TFeatureToFind));

        /// <summary>
        /// Add or update the feature. Existing feature of the same type will be replaced.
        /// </summary>
        /// <param name="feature">The feature.</param>
        public void AddOrUpdate(TFeature feature) => _features[feature.GetType()] = feature;

        public IEnumerator<TFeature> GetEnumerator() => _features.Values.GetEnumerator();

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

        protected void MakeReadOnly() => _features = new ReadOnlyDictionary<Type, TFeature>(_features);

        public void ForAll(Action<TFeature> action)
        {
            foreach (var feature in this)
            {
                action(feature);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.11681772406847936, 'fraction_numerical': 0.0, 'mean_word_length': 2.776932826362484, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 51, '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': '2630405', 'n_tokens_mistral': 773, 'n_tokens_neox': 774, 'n_words': 204}