<commit_before>/*******************************************************************************
 * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
 * Technische Universitaet Muenchen.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 ******************************************************************************/
package org.eclipse.emf.emfstore.client.model.changeTracking.merging.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;

/**
 * Key-Value-Store for conflict descriptions.
 * 
 * @author wesendon
 * 
 */
public class DescriptionProvider {

	private Properties properties;
	private String prefix;

	/**
	 * Default constructor.
	 * 
	 * @param prefix
	 *            prefix for all keys
	 */
	public DescriptionProvider(String prefix) {
		properties = load();
		this.prefix = prefix;
	}

	/**
	 * Default constructor.
	 */
	public DescriptionProvider() {
		this(null);
	}

	private Properties load() {
		Properties properties = new Properties();
		URL url;
		InputStream inputStream = null;

		try {
			url = new URL("platform:/plugin/de.vogella.rcp.plugin.filereader/files/test.txt");
			inputStream = url.openConnection().getInputStream();
			properties.load(inputStream);
		} catch (MalformedURLException e2) {
			// ignore
		} catch (IOException e) {
			// ignore
		} finally {
			if (inputStream != null) {
				try {
					inputStream.close();
				} catch (IOException e) {
					// ignore
				}
			}
		}

		return properties;
	}

	/**
	 * Returns a description for given key.
	 * 
	 * @param key
	 *            key<commit_msg>fixed path in description provider <commit_after>/*******************************************************************************
 * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
 * Technische Universitaet Muenchen.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 ******************************************************************************/
package org.eclipse.emf.emfstore.client.model.changeTracking.merging.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;

/**
 * Key-Value-Store for conflict descriptions.
 * 
 * @author wesendon
 * 
 */
public class DescriptionProvider {

	private Properties properties;
	private String prefix;

	/**
	 * Default constructor.
	 * 
	 * @param prefix
	 *            prefix for all keys
	 */
	public DescriptionProvider(String prefix) {
		properties = load();
		this.prefix = prefix;
	}

	/**
	 * Default constructor.
	 */
	public DescriptionProvider() {
		this(null);
	}

	private Properties load() {
		Properties properties = new Properties();
		URL url;
		InputStream inputStream = null;

		try {
			url = new URL("platform:/plugin/org.eclipse.emf.emfstore.client/resources/conflictdescription.ini");
			inputStream = url.openConnection().getInputStream();
			properties.load(inputStream);
		} catch (MalformedURLException e2) {
			// ignore
		} catch (IOException e) {
			// ignore
		} finally {
			if (inputStream != null) {
				try {
					inputStream.close();
				} catch (IOException e) {
					// ignore
				}
			}
		}

		return properties;
	}

	/**
	 * Returns a description for given key.
	 * 
	 * @param key
	 *            key
{'fraction_non_alphanumeric': 0.18301687763713081, 'fraction_numerical': 0.006856540084388186, 'mean_word_length': 3.5698795180722893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4160524', 'n_tokens_mistral': 1165, 'n_tokens_neox': 995, 'n_words': 280}