<commit_before>/*
 * Copyright 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.buildinit.plugins.internal.modifiers;

import org.gradle.api.GradleException;
import org.gradle.api.tasks.wrapper.Wrapper;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;

public enum BuildInitBuildScriptDsl {

    GROOVY(".gradle", Wrapper.DistributionType.BIN),
    KOTLIN(".gradle.kts", Wrapper.DistributionType.ALL);

    private final String fileExtension;
    private final Wrapper.DistributionType wrapperDistributionType;

    BuildInitBuildScriptDsl(String fileExtension, Wrapper.DistributionType wrapperDistributionType) {
        this.fileExtension = fileExtension;
        this.wrapperDistributionType = wrapperDistributionType;
    }

    public static BuildInitBuildScriptDsl fromName(@Nullable String name) {
        if (name == null) {
            return GROOVY;
        }
        for (BuildInitBuildScriptDsl language : values()) {
            if (language.getId().equals(name)) {
                return language;
            }
        }
        throw new GradleException("The requested build script DSL '" + name + "' is not supported.");
    }

    public static List<String> listSupported() {
        List<String> result = new ArrayList<String>();
        for (BuildInitBuildScriptDsl language : values()) {
            result.add(language.getId());
        }
        return result;
    }

    public String getId() {
        return name().toLowerCase();
    }

    public Wrapper.DistributionType getWrapperDistributionType() {
        return wrapperDistributionType;
    }

    public String fileNameFor(String fileNameWithoutExtension) {
        return fileNameWithoutExtension + fileExtension;
    }

    @Override
    public String toString() {
        return getId();
    }
}<commit_msg>Refine BuildInitBuildScriptDsl<commit_after>/*
 * Copyright 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.buildinit.plugins.internal.modifiers;

import com.google.common.collect.ImmutableList;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.wrapper.Wrapper;

import javax.annotation.Nullable;
import java.util.List;

public enum BuildInitBuildScriptDsl {

    GROOVY(".gradle", Wrapper.DistributionType.BIN),
    KOTLIN(".gradle.kts", Wrapper.DistributionType.ALL);

    private final String fileExtension;
    private final Wrapper.DistributionType wrapperDistributionType;

    BuildInitBuildScriptDsl(String fileExtension, Wrapper.DistributionType wrapperDistributionType) {
        this.fileExtension = fileExtension;
        this.wrapperDistributionType = wrapperDistributionType;
    }

    public static BuildInitBuildScriptDsl fromName(@Nullable String name) {
        if (name == null) {
            return GROOVY;
        }
        for (BuildInitBuildScriptDsl language : values()) {
            if (language.getId().equals(name)) {
                return language;
            }
        }
        throw new GradleException("The requested build script DSL '" + name + "' is not supported.");
    }

    public static List<String> listSupported() {
        ImmutableList.Builder<String> supported = ImmutableList.builder();
        for (BuildInitBuildScriptDsl language : values()) {
            supported.add(language.getId());
        }
        return supported.build();
    }

    public String getId() {
        return name().toLowerCase();
    }

    public Wrapper.DistributionType getWrapperDistributionType() {
        return wrapperDistributionType;
    }

    public String fileNameFor(String fileNameWithoutExtension) {
        return fileNameWithoutExtension + fileExtension;
    }

    @Override
    public String toString() {
        return getId();
    }
}
{'fraction_non_alphanumeric': 0.08598399343320337, 'fraction_numerical': 0.0032833983172583622, 'mean_word_length': 3.1801029159519727, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7065522', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1213, 'n_words': 378}