<commit_before>package com.cube.storm.language.lib.manager;

import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.cube.storm.LanguageSettings;
import com.cube.storm.language.data.Language;
import com.cube.storm.language.lib.processor.LanguageProcessor;
import com.cube.storm.util.lib.resolver.Resolver;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.io.UnsupportedEncodingException;
import java.util.Locale;

/**
 * Manager which controls the lookup and parsing of language files
 *
 * @author <NAME>
 * @project StormLanguage
 */
public class LanguageManager
{
	private static LanguageManager instance;

	/**
	 * Gets the language manager singleton or creates one if its null
	 *
	 * @return The language manager singleton
	 */
	public static LanguageManager getInstance()
	{
		if (instance == null)
		{
			synchronized(LanguageManager.class)
			{
				if (instance == null)
				{
					instance = new LanguageManager();
				}
			}
		}

		return instance;
	}

	private LanguageManager(){}

	/**
	 * Gets a string value from the selected language or falls back to android String resources if not
	 * found using the same key
	 *
	 * @param context The context of the resources to fall back to
	 * @param key The key of the string to lookup
	 *
	 * @return The string, or an empty string
	 */
	@NonNull
	public String getValue(@NonNull Context context, @NonNull String key)
	{
		if (LanguageSettings.getInstance().getDefaultLanguage().hasValue(key)
		|| (LanguageSettings.getInstance().getFallbackLanguage() != null && LanguageSettings.getInstance().getFallbackLanguage().hasValue(key)))
		{
			return getValue(key);
		}
		else
		{
			int resource = context.getResources().getIdentifier(key.toLowerCase(Locale.ENGLISH), "string", context.getPackageName());

			if (resource > 0)
			{
				return context.getString(resource);
			}

			return "";
		}
	}<commit_msg>Removed instance from language manager and declared class abstract<commit_after>package com.cube.storm.language.lib.manager;

import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.cube.storm.LanguageSettings;
import com.cube.storm.language.data.Language;
import com.cube.storm.language.lib.processor.LanguageProcessor;
import com.cube.storm.util.lib.resolver.Resolver;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.io.UnsupportedEncodingException;
import java.util.Locale;

/**
 * Manager which controls the lookup and parsing of language files.
 * <p/>
 * Access this class via {@link com.cube.storm.LanguageSettings#getLanguageManager()}. Do not instantiate this class directly
 *
 * @author <NAME>
 * @project StormLanguage
 */
public abstract class LanguageManager
{
	/**
	 * Gets a string value from the selected language or falls back to android String resources if not
	 * found using the same key
	 *
	 * @param context The context of the resources to fall back to
	 * @param key The key of the string to lookup
	 *
	 * @return The string, or an empty string
	 */
	@NonNull
	public String getValue(@NonNull Context context, @NonNull String key)
	{
		if (LanguageSettings.getInstance().getDefaultLanguage().hasValue(key)
		|| (LanguageSettings.getInstance().getFallbackLanguage() != null && LanguageSettings.getInstance().getFallbackLanguage().hasValue(key)))
		{
			return getValue(key);
		}
		else
		{
			int resource = context.getResources().getIdentifier(key.toLowerCase(Locale.ENGLISH), "string", context.getPackageName());

			if (resource > 0)
			{
				return context.getString(resource);
			}

			return "";
		}
	}
{'fraction_non_alphanumeric': 0.10622317596566523, 'fraction_numerical': 0.000536480686695279, 'mean_word_length': 4.327142857142857, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '1566469', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1047, 'n_words': 300}