<commit_before>using System.Collections.Generic;
using System.Linq;

namespace Entitas.CodeGenerator {

    public class EntityIndexGenerator : ICodeGenerator {

        public string name { get { return "Entity Index"; } }
        public bool isEnabledByDefault { get { return true; } }

        const string CLASS_TEMPLATE =
@"public partial class Contexts {

${indexConstants}

    [Entitas.CodeGenerator.Api.PostConstructor]
    public void InitializeEntityIndices() {
${addIndices}
    }
}

public static class ContextsExtensions {

${getIndices}
}";

        const string INDEX_CONSTANTS_TEMPLATE = @"    public const string ${IndexName} = ""${IndexName}"";";

        const string ADD_INDEX_TEMPLATE =
@"        ${contextName}.AddEntityIndex(new ${IndexType}<${ContextName}Entity, ${KeyType}>(
            ${IndexName},
            ${contextName}.GetGroup(${ContextName}Matcher.${IndexName}),
            (e, c) => { var component = c as ${ComponentType}; return component != null ? component.${MemberName} : e.${componentName}.${MemberName}; }));";<commit_msg>Simplified EntityIndexGenerator getKey<commit_after>using System.Collections.Generic;
using System.Linq;

namespace Entitas.CodeGenerator {

    public class EntityIndexGenerator : ICodeGenerator {

        public string name { get { return "Entity Index"; } }
        public bool isEnabledByDefault { get { return true; } }

        const string CLASS_TEMPLATE =
@"public partial class Contexts {

${indexConstants}

    [Entitas.CodeGenerator.Api.PostConstructor]
    public void InitializeEntityIndices() {
${addIndices}
    }
}

public static class ContextsExtensions {

${getIndices}
}";

        const string INDEX_CONSTANTS_TEMPLATE = @"    public const string ${IndexName} = ""${IndexName}"";";

        const string ADD_INDEX_TEMPLATE =
@"        ${contextName}.AddEntityIndex(new ${IndexType}<${ContextName}Entity, ${KeyType}>(
            ${IndexName},
            ${contextName}.GetGroup(${ContextName}Matcher.${IndexName}),
            (e, c) => ((${ComponentType})c).${MemberName}));";
{'fraction_non_alphanumeric': 0.1301402999516207, 'fraction_numerical': 0.0, 'mean_word_length': 3.787037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6724378', 'n_tokens_mistral': 582, 'n_tokens_neox': 568, 'n_words': 131}