<commit_before>package graphql.execution2;

import graphql.GraphQLError;
import graphql.Internal;
import graphql.execution.ExecutionStepInfo;

import java.util.ArrayList;
import java.util.List;

import static graphql.Assert.assertNotNull;

@Internal
public class FetchedValueAnalysis {


    public enum FetchedValueType {
        OBJECT,
        LIST,
        SCALAR,
        ENUM,
        DEFER
    }


    private final FetchedValueType valueType;
    private final List<GraphQLError> errors;

    // not applicable for LIST
    private final Object completedValue;

    private final boolean nullValue;

    // only available for LIST
    private final List<FetchedValueAnalysis> children;

    // only for object
    private final FieldSubSelection fieldSubSelection;


    // for children of list name is the same as for the list itself
    private final String name;

    private final ExecutionStepInfo executionStepInfo;
    // for LIST this is the whole list
    private final FetchedValue fetchedValue;


    private FetchedValueAnalysis(Builder builder) {
        this.valueType = assertNotNull(builder.valueType);
        this.errors = new ArrayList<>(builder.errors);
        this.completedValue = builder.completedValue;
        this.nullValue = builder.nullValue;
        this.children = builder.children;
        this.fieldSubSelection = builder.fieldSubSelection;
        this.name = builder.name;
        this.executionStepInfo = assertNotNull(builder.executionInfo);
        this.fetchedValue = assertNotNull(builder.fetchedValue);
    }


    public FetchedValueType getValueType() {
        return valueType;
    }


    public List<GraphQLError> getErrors() {
        return errors;
    }

    public Object getCompletedValue() {
        return completedValue;
    }

    public List<FetchedValueAnalysis> getChildren() {
        return children;
    }

    public boolean isNullValue() {
        return nullValue;
    }


    public FetchedValue getFetchedValue() {
        return fetchedValue;
    }

    public String getName() {
        return name;
    }

    public static Builder newFetchedValueAnalysis() {
        return new Builder();
    }

    public static Builder newFetchedValueAnalysis(FetchedValueType valueType) {
        return new Builder().valueType(valueType);
    }

    public static Builder newBuilder(FetchedValueAnalysis existing) {
        return new Builder(existing);
    }

    public ExecutionStepInfo getExecutionStepInfo() {
        return executionStepInfo;
    }


    public FieldSubSelection getFieldSubSelection() {
        return fieldSubSelection;
    }


    @Override
    public String toString() {
        return "FetchedValueAnalysis{" +
                "valueType=" + valueType +<commit_msg>rename newBuilder method and add transform<commit_after>package graphql.execution2;

import graphql.GraphQLError;
import graphql.Internal;
import graphql.execution.ExecutionStepInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

import static graphql.Assert.assertNotNull;

@Internal
public class FetchedValueAnalysis {


    public enum FetchedValueType {
        OBJECT,
        LIST,
        SCALAR,
        ENUM,
        DEFER
    }


    private final FetchedValueType valueType;
    private final List<GraphQLError> errors;

    // not applicable for LIST
    private final Object completedValue;

    private final boolean nullValue;

    // only available for LIST
    private final List<FetchedValueAnalysis> children;

    // only for object
    private final FieldSubSelection fieldSubSelection;


    // for children of list name is the same as for the list itself
    private final String name;

    private final ExecutionStepInfo executionStepInfo;
    // for LIST this is the whole list
    private final FetchedValue fetchedValue;


    private FetchedValueAnalysis(Builder builder) {
        this.valueType = assertNotNull(builder.valueType);
        this.errors = new ArrayList<>(builder.errors);
        this.completedValue = builder.completedValue;
        this.nullValue = builder.nullValue;
        this.children = builder.children;
        this.fieldSubSelection = builder.fieldSubSelection;
        this.name = builder.name;
        this.executionStepInfo = assertNotNull(builder.executionInfo);
        this.fetchedValue = assertNotNull(builder.fetchedValue);
    }


    public FetchedValueType getValueType() {
        return valueType;
    }


    public List<GraphQLError> getErrors() {
        return errors;
    }

    public Object getCompletedValue() {
        return completedValue;
    }

    public List<FetchedValueAnalysis> getChildren() {
        return children;
    }

    public boolean isNullValue() {
        return nullValue;
    }


    public FetchedValue getFetchedValue() {
        return fetchedValue;
    }

    public String getName() {
        return name;
    }

    public FetchedValueAnalysis transfrom(Consumer<Builder> builderConsumer) {
        Builder builder = new Builder(this);
        builderConsumer.accept(builder);
        return builder.build();
    }


    public static Builder newFetchedValueAnalysis() {
        return new Builder();
    }

    public static Builder newFetchedValueAnalysis(FetchedValueType valueType) {
        return new Builder().valueType(valueType);
    }

    public static Builder newFetchedValueAnalysis(FetchedValueAnalysis existing) {
        return new Builder(existing);
    }

    public ExecutionStepInfo getExecutionStepInfo() {
        return executionStepInfo;
    }


    public FieldSubSelection getFieldSubSelection() {
        return fieldSubSelection;
    }


    @Override
    public String toString() {
        return "FetchedValueAnalysis{" +
                "valueType=" + valueType +
{'fraction_non_alphanumeric': 0.06858521454420127, 'fraction_numerical': 0.0003446493193175943, 'mean_word_length': 2.861610113107119, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '1789395', 'n_tokens_mistral': 1577, 'n_tokens_neox': 1489, 'n_words': 402}