<commit_before>package jpaoletti.jpm.util;

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

/**
 * List of properties.
 *
 * @author jpaoletti
 * @since 22/09/2011
 * @version 1.0
 *
 */
public class Properties {

    private List<Property> properties;

    public String getProperty(String name) {
        for (Property property : properties) {
            if (property.getName().equals(name)) {
                return property.getValue();
            }
        }
        return null;
    }

    public String getProperty(String name, String def) {
        final String s = getProperty(name);
        if (s == null) {
            return def;
        } else {
            return s;
        }
    }

    /**
     * Returns the property assuming its an int. If it isn't or if its not defined,
     * returns default value
     * 
     * @param name Property name
     * @param def Default value
     * 
     * @return Property value or def
     */
    public Integer getInt(String name, Integer def) {
        final String s = getProperty(name);
        try {
            return Integer.parseInt(s);
        } catch (Exception e) {
            return def;
        }
    }

    /**
     * Returns the property assuming its a boolean. If it isn't or if its not 
     * defined, returns default value.
     * 
     * @param name Property name
     * @param def Default value
     * 
     * @return Property value or def
     */
    public boolean getBool(String name, boolean def) {
        final String s = getProperty(name);
        try {
            return s != null && s.equalsIgnoreCase("true");
        } catch (Exception e) {
            return def;
        }
    }

    /**
     * Return all values for the given name
     */
    public List<String> getAll(String name) {
        final List<String> all = new ArrayList<String>();
        for (Property property : properties) {
            if (property.getName().equals(name)) {
                all.add(property.getValue());
            }
        }
        return all;
    }

    public List<Property> getProperties() {
        return properties;
    }

    public void setProperties(List<Property> properties) {
        this.properties = properties;
    }
}
<commit_msg>missing null check<commit_after>package jpaoletti.jpm.util;

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

/**
 * List of properties.
 *
 * @author jpaoletti
 * @since 22/09/2011
 * @version 1.0
 *
 */
public class Properties {

    private List<Property> properties;

    public String getProperty(String name) {
        for (Property property : properties) {
            if (property.getName().equals(name)) {
                return property.getValue();
            }
        }
        return null;
    }

    public String getProperty(String name, String def) {
        final String s = getProperty(name);
        if (s == null) {
            return def;
        } else {
            return s;
        }
    }

    /**
     * Returns the property assuming its an int. If it isn't or if its not defined,
     * returns default value
     * 
     * @param name Property name
     * @param def Default value
     * 
     * @return Property value or def
     */
    public Integer getInt(String name, Integer def) {
        final String s = getProperty(name);
        try {
            return Integer.parseInt(s);
        } catch (Exception e) {
            return def;
        }
    }

    /**
     * Returns the property assuming its a boolean. If it isn't or if its not 
     * defined, returns default value.
     * 
     * @param name Property name
     * @param def Default value
     * 
     * @return Property value or def
     */
    public boolean getBool(String name, boolean def) {
        final String s = getProperty(name);
        if (s == null) {
            return def;
        }
        try {
            return s != null && s.equalsIgnoreCase("true");
        } catch (Exception e) {
            return def;
        }
    }

    /**
     * Return all values for the given name
     */
    public List<String> getAll(String name) {
        final List<String> all = new ArrayList<String>();
        for (Property property : properties) {
            if (property.getName().equals(name)) {
                all.add(property.getValue());
            }
        }
        return all;
    }

    public List<Property> getProperties() {
        return properties;
    }

    public void setProperties(List<Property> properties) {
        this.properties = properties;
    }
}

{'fraction_non_alphanumeric': 0.09893758300132802, 'fraction_numerical': 0.004426737494466578, 'mean_word_length': 1.7605375687232743, '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': '6439827', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1201, 'n_words': 385}