<commit_before>package graphql.schema;


import graphql.GraphQLException;
import graphql.language.EnumValue;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static graphql.Assert.assertNotNull;

public class GraphQLEnumType implements GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLUnmodifiedType {

    private final String name;
    private final String description;
    private final Map<String, GraphQLEnumValueDefinition> valueDefinitionMap = new LinkedHashMap<>();

    private final Coercing coercing = new Coercing() {
        @Override
        public Object coerce(Object input) {
            return getNameByValue(input);
        }

        @Override
        public Object coerceValue(Object input) {
            return getValueByName(input);
        }

        @Override
        public Object coerceLiteral(Object input) {
            if (!(input instanceof EnumValue)) return null;
            EnumValue enumValue = (EnumValue) input;
            GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap.get(enumValue.getName());
            if (enumValueDefinition == null) return null;
            if (enumValueDefinition.getValue() != null) return enumValueDefinition.getValue();
            return enumValueDefinition.getValue();
        }
    };

    private Object getValueByName(Object value) {
        GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap.get(value);
        if (enumValueDefinition.getValue() != null) return enumValueDefinition.getValue();
        throw new GraphQLException("");
    }

    private Object getNameByValue(Object value) {
        for (GraphQLEnumValueDefinition valueDefinition : valueDefinitionMap.values()) {
            if (value.equals(valueDefinition.getValue())) return valueDefinition.getName();
        }
        throw new GraphQLException("");
    }

    public List<GraphQLEnumValueDefinition> getValues() {
        return new ArrayList<>(valueDefinitionMap.values());
    }


    public GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values) {
        assertNotNull(name, "name can't be null");
        this.name = name;
        this.description = description;
        buildMap(values);
    }

    private void buildMap(List<GraphQLEnumValueDefinition> values) {
        for (GraphQLEnumValueDefinition valueDefinition : values) {<commit_msg>delete useless and wrong check<commit_after>package graphql.schema;


import graphql.GraphQLException;
import graphql.language.EnumValue;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static graphql.Assert.assertNotNull;

public class GraphQLEnumType implements GraphQLType, GraphQLInputType, GraphQLOutputType, GraphQLUnmodifiedType {

    private final String name;
    private final String description;
    private final Map<String, GraphQLEnumValueDefinition> valueDefinitionMap = new LinkedHashMap<>();

    private final Coercing coercing = new Coercing() {
        @Override
        public Object coerce(Object input) {
            return getNameByValue(input);
        }

        @Override
        public Object coerceValue(Object input) {
            return getValueByName(input);
        }

        @Override
        public Object coerceLiteral(Object input) {
            if (!(input instanceof EnumValue)) return null;
            EnumValue enumValue = (EnumValue) input;
            GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap.get(enumValue.getName());
            if (enumValueDefinition == null) return null;
            return enumValueDefinition.getValue();
        }
    };

    private Object getValueByName(Object value) {
        GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap.get(value);
        if (enumValueDefinition.getValue() != null) return enumValueDefinition.getValue();
        throw new GraphQLException("");
    }

    private Object getNameByValue(Object value) {
        for (GraphQLEnumValueDefinition valueDefinition : valueDefinitionMap.values()) {
            if (value.equals(valueDefinition.getValue())) return valueDefinition.getName();
        }
        throw new GraphQLException("");
    }

    public List<GraphQLEnumValueDefinition> getValues() {
        return new ArrayList<>(valueDefinitionMap.values());
    }


    public GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values) {
        assertNotNull(name, "name can't be null");
        this.name = name;
        this.description = description;
        buildMap(values);
    }

    private void buildMap(List<GraphQLEnumValueDefinition> values) {
        for (GraphQLEnumValueDefinition valueDefinition : values) {
{'fraction_non_alphanumeric': 0.0834026622296173, 'fraction_numerical': 0.0, 'mean_word_length': 3.3599274705349047, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '408800', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1184, 'n_words': 301}