<commit_before>/*
 * Created on Sep 14, 2012
 */
package org.griphyn.vdl.mapping;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.griphyn.vdl.karajan.lib.Tracer;

public class MappingParamSet {
    private Map<String, Object> params;
    
    public MappingParamSet() {
        params = new HashMap<String, Object>();
    }

    public void set(MappingParam p, Object value) {
        params.put(p.getName(), value);
    }

    public void setAll(Map<String, Object> m) {
        if (m != null) {
            for (Map.Entry<String, Object> e : m.entrySet()) {
                params.put(e.getKey(), e.getValue());
            }
        }
    }

    public Object get(MappingParam p) {
        return params.get(p.getName());
    }
    
    public boolean isPresent(MappingParam p) {
        return params.containsKey(p.getName());
    }

    public AbstractDataNode getFirstOpenParamValue() {
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            Object v = entry.getValue();
            if (v instanceof AbstractDataNode && !((AbstractDataNode) v).isClosed()) {
                return (AbstractDataNode) v;        
            }
        }
        return null;
    }

    public Collection<String> names() {
        return params.keySet();
    }

    @Override
    public String toString() {
        Object desc = get(MappingParam.SWIFT_DESCRIPTOR);
        if (desc == null) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        sb.append("<");
        sb.append(desc);
        sb.append("; ");
        sb.append("input = " + get(MappingParam.SWIFT_INPUT));
        for (String name : names()) {
            if (name.indexOf('#') >= 0) {
                // skip internal parameters
                continue;
            }
            sb.append(", ");
            sb.append(name);
            sb.append(" = \"");
            sb.append(Tracer.unwrapHandle(params.get(name)));
            sb.append("\"");
        }
        sb.append('>');
        return sb.toString();
    }
}
<commit_msg>don't put quotes around all mapping param values<commit_after>/*
 * Created on Sep 14, 2012
 */
package org.griphyn.vdl.mapping;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.griphyn.vdl.karajan.lib.Tracer;

public class MappingParamSet {
    private Map<String, Object> params;
    
    public MappingParamSet() {
        params = new HashMap<String, Object>();
    }

    public void set(MappingParam p, Object value) {
        params.put(p.getName(), value);
    }

    public void setAll(Map<String, Object> m) {
        if (m != null) {
            for (Map.Entry<String, Object> e : m.entrySet()) {
                params.put(e.getKey(), e.getValue());
            }
        }
    }

    public Object get(MappingParam p) {
        return params.get(p.getName());
    }
    
    public boolean isPresent(MappingParam p) {
        return params.containsKey(p.getName());
    }

    public AbstractDataNode getFirstOpenParamValue() {
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            Object v = entry.getValue();
            if (v instanceof AbstractDataNode && !((AbstractDataNode) v).isClosed()) {
                return (AbstractDataNode) v;        
            }
        }
        return null;
    }

    public Collection<String> names() {
        return params.keySet();
    }

    @Override
    public String toString() {
        Object desc = get(MappingParam.SWIFT_DESCRIPTOR);
        if (desc == null) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        sb.append("<");
        sb.append(desc);
        sb.append("; ");
        sb.append("input = " + get(MappingParam.SWIFT_INPUT));
        for (String name : names()) {
            if (name.indexOf('#') >= 0) {
                // skip internal parameters
                continue;
            }
            sb.append(", ");
            sb.append(name);
            sb.append(" = ");
            sb.append(Tracer.unwrapHandle(params.get(name)));
        }
        sb.append('>');
        return sb.toString();
    }
}

{'fraction_non_alphanumeric': 0.1353221957040573, 'fraction_numerical': 0.003341288782816229, 'mean_word_length': 1.874485596707819, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '3307094', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1191, 'n_words': 266}