<commit_before>package org.nakedobjects.distribution;

import org.nakedobjects.object.InstancesCriteria;
import org.nakedobjects.object.Session;
import org.nakedobjects.object.control.Hint;
import org.nakedobjects.utility.Logger;


public class DistributionLogger extends Logger implements Distribution {
    private static String padding = "      ";

    public static String dump(Data data) {
        StringBuffer str = new StringBuffer();
        dump(str, data, 1);
        return str.toString();
    }

    public static String dump(Data[] data) {
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            str.append("\n    [");
            str.append(i + 1);
            str.append("] ");
            dump(str, data[i], 3);
        }
        return str.toString();
    }

    private static void dump(StringBuffer str, Data data, int indent) {
        if (data == null) {
            str.append("null");
        } else if (data instanceof NullData) {
            str.append("NULL (NullData object)");
        } else if (data instanceof ValueData) {
            ValueData valueData = ((ValueData) data);
            str.append("ValueData " + valueData.getType() + ":" + valueData.getValue());
        } else if (data instanceof ObjectData) {
            ObjectData objectData = ((ObjectData) data);
            str.append("ObjectData " + objectData.getType() + ":" + objectData.getOid() + ":"
                    + (objectData.hasCompleteData() ? "C" : "-") + ":" + objectData.getVersion());
            Object[] fields = objectData.getFieldContent();
            for (int i = 0; fields != null && i < fields.length; i++) {
                str.append("\n");
                str.append(padding(indent));
                str.append(i + 1);
                str.append(") ");
                dump(str, (Data) fields[i], indent + 1);
            }
        } else if (data instanceof CollectionData) {
            CollectionData objectData = ((CollectionData) data);
            str.append("CollectionData " + objectData.getType() + ":" + objectData.getOid() + ":"
                    + (objectData.hasAllElements() ? "A" : "-") + ":" + objectData.getVersion());
            Object[] elements = objectData.getElements();
            for (int i = 0; elements != null && i < elements.length; i++) {
                str.append("\n");
                str.append(padding(indent));
                str.append(i + 1);
                str.append(") ");
                dump(str, (Data) elements[i], indent + 1);
            }
        } else if (data instanceof ReferenceData) {
            ReferenceData referenceData = (ReferenceData) data;
            str.append("ReferenceData " + referenceData.getType() + ":" + referenceData.getOid() + ":"<commit_msg>Each field in an object is labeled with its field name when logging  distribution<commit_after>package org.nakedobjects.distribution;

import org.nakedobjects.object.InstancesCriteria;
import org.nakedobjects.object.NakedObjectField;
import org.nakedobjects.object.NakedObjects;
import org.nakedobjects.object.Session;
import org.nakedobjects.object.control.Hint;
import org.nakedobjects.utility.Logger;


public class DistributionLogger extends Logger implements Distribution {
    private static String padding = "      ";

    public static String dump(Data data) {
        StringBuffer str = new StringBuffer();
        dump(str, data, 1);
        return str.toString();
    }

    public static String dump(Data[] data) {
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            str.append("\n    [");
            str.append(i + 1);
            str.append("] ");
            dump(str, data[i], 3);
        }
        return str.toString();
    }

    private static void dump(StringBuffer str, Data data, int indent) {
        if (data == null) {
            str.append("null");
        } else if (data instanceof NullData) {
            str.append("NULL (NullData object)");
        } else if (data instanceof ValueData) {
            ValueData valueData = ((ValueData) data);
            str.append("ValueData " + valueData.getType() + ":" + valueData.getValue());
        } else if (data instanceof ObjectData) {
            ObjectData objectData = ((ObjectData) data);
            str.append("ObjectData " + objectData.getType() + ":" + objectData.getOid() + ":"
                    + (objectData.hasCompleteData() ? "C" : "-") + ":" + objectData.getVersion());
            NakedObjectField[] fs = NakedObjects.getSpecificationLoader().loadSpecification(objectData.getType()).getFields();
            Object[] fields = objectData.getFieldContent();
            for (int i = 0; fields != null && i < fields.length; i++) {
                str.append("\n");
                str.append(padding(indent));
                str.append(i + 1);
                str.append(") ");
                str.append(fs[i].getId());
                str.append(": ");
                dump(str, (Data) fields[i], indent + 1);
            }
        } else if (data instanceof CollectionData) {
            CollectionData objectData = ((CollectionData) data);
            str.append("CollectionData " + objectData.getType() + ":" + objectData.getOid() + ":"
                    + (objectData.hasAllElements() ? "A" : "-") + ":" + objectData.getVersion());
            Object[] elements = objectData.getElements();
            for (int i = 0; elements != null && i < elements.length; i++) {
                str.append("\n");
                str.append(padding(indent));
                str.append(i + 1);
                str.append(") ");
                dump(str, (Data) elements[i], indent + 1);
            }
        } else if (data instanceof ReferenceData) {
            ReferenceData referenceData = (ReferenceData) data;
            str.append("ReferenceData " + referenceData.getType() + ":" + referenceData.getOid() + ":"
{'fraction_non_alphanumeric': 0.14132259147364887, 'fraction_numerical': 0.003356831151393085, 'mean_word_length': 2.1313715186547557, 'pattern_counts': {'":': 19, '<': 9, '<?xml version=': 0, '>': 3, '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': '143195', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1571, 'n_words': 380}