<commit_before>package edu.neu.ccs.pyramid.configuration;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;

/**
 * Created by chengli on 8/11/14.
 */
public class Config {
    private Properties properties;

    public Config(String configFile) {
        this.properties = new Properties();
        try {
            properties.load(new FileInputStream(configFile));
        } catch (IOException e) {
            e.printStackTrace();
        }
//        System.out.println("config file "+configFile+" loaded.");
    }

    public Config(File configFile) {
        this.properties = new Properties();
        try {
            properties.load(new FileInputStream(configFile));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public Config(){
        this.properties = new Properties();
    }

    public void setInt(String key, int value){
        this.properties.setProperty(key,""+value);
    }

    public void setDouble(String key, double value){
        this.properties.setProperty(key,""+value);
    }

    public void setBoolean(String key, boolean value){
        this.properties.setProperty(key,""+value);
    }

    public void setString(String key, String value){
        this.properties.setProperty(key,value);
    }

    public int getInt(String key){
        if (!containsKey(key)){
            throw new IllegalArgumentException("config does not contain the key "+key);
        }
        return Integer.parseInt(this.properties.getProperty(key));
    }

    public double getDouble(String key){
        if (!containsKey(key)){
            throw new IllegalArgumentException("config does not contain the key "+key);
        }
        return Double.parseDouble(this.properties.getProperty(key));
    }

    public boolean getBoolean(String key){<commit_msg>add methods<commit_after>package edu.neu.ccs.pyramid.configuration;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;

/**
 * Created by chengli on 8/11/14.
 */
public class Config {
    private Properties properties;

    public Config(String configFile) {
        this.properties = new Properties();
        try {
            properties.load(new FileInputStream(configFile));
        } catch (IOException e) {
            e.printStackTrace();
        }
//        System.out.println("config file "+configFile+" loaded.");
    }

    public Config(File configFile) {
        this.properties = new Properties();
        try {
            properties.load(new FileInputStream(configFile));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public Config(){
        this.properties = new Properties();
    }

    public void setInt(String key, int value){
        this.properties.setProperty(key,""+value);
    }

    public void setDouble(String key, double value){
        this.properties.setProperty(key,""+value);
    }

    public void setBoolean(String key, boolean value){
        this.properties.setProperty(key,""+value);
    }

    public void setString(String key, String value){
        this.properties.setProperty(key,value);
    }

    public int getInt(String key){
        if (!containsKey(key)){
            throw new IllegalArgumentException("config does not contain the key "+key);
        }
        return Integer.parseInt(this.properties.getProperty(key));
    }

    public List<Integer> getIntegers(String key){
        if (!containsKey(key)){
            throw new IllegalArgumentException("config does not contain the key "+key);
        }
        List<Integer> list = new ArrayList<>();
        String values = this.properties.getProperty(key);
        String[] valuesSplit = values.split(",");
        for (String valueString: valuesSplit){
            list.add(Integer.parseInt(valueString.trim()));
        }
        return list;
    }

    public List<Double> getDoubles(String key){
        if (!containsKey(key)){
            throw new IllegalArgumentException("config does not contain the key "+key);
        }
        List<Double> list = new ArrayList<>();
        String values = this.properties.getProperty(key);
        String[] valuesSplit = values.split(",");
        for (String valueString: valuesSplit){
            list.add(Double.parseDouble(valueString.trim()));
        }
        return list;
    }

    public double getDouble(String key){
        if (!containsKey(key)){
            throw new IllegalArgumentException("config does not contain the key "+key);
        }
        return Double.parseDouble(this.properties.getProperty(key));
    }

    public boolean getBoolean(String key){
{'fraction_non_alphanumeric': 0.11521418020679468, 'fraction_numerical': 0.002110149820637265, 'mean_word_length': 2.56390977443609, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1215959', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1210, 'n_words': 312}