<commit_before>package it.near.sdk.Recipes;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import it.near.sdk.Recipes.Models.Recipe;

import static com.google.gson.internal.$Gson$Preconditions.checkNotNull;

/**
 * Created by cattaneostefano on 13/02/2017.
 */

public class RecipeCooler {

    private SharedPreferences mSharedPreferences;

    public static final String NEAR_RECIPECOOLER_PREFSNAME = "NearRecipeCoolerPrefsName";
    public static final String LOG_MAP = "LOG_MAP";
    public static final String LATEST_LOG = "LATEST_LOG";

    public static final String GLOBAL_COOLDOWN = "global_cooldown";
    public static final String SELF_COOLDOWN = "self_cooldown";

    private Map<String, Long> mRecipeLogMap;
    private Long mLatestLogEntry;

    public RecipeCooler(@NonNull SharedPreferences sharedPreferences) {
        checkNotNull(sharedPreferences);
        mSharedPreferences = sharedPreferences;
    }

    public void markRecipeAsShown(String recipeId){
        long timeStamp = System.currentTimeMillis();
        getMap().put(recipeId, new Long(timeStamp));
        saveMap(mRecipeLogMap);
        saveLatestEntry(System.currentTimeMillis());

    }

    private boolean canShowRecipe(Recipe recipe){
        Map <String, Object> cooldown = recipe.getCooldown();
        return cooldown == null ||
                ( globalCooldownCheck(cooldown) && selfCooldownCheck(recipe, cooldown) );
    }

    private boolean globalCooldownCheck(Map<String, Object> cooldown) {
        if (!cooldown.containsKey(GLOBAL_COOLDOWN) ||<commit_msg>dependency as a final field<commit_after>package it.near.sdk.Recipes;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import it.near.sdk.Recipes.Models.Recipe;

import static com.google.gson.internal.$Gson$Preconditions.checkNotNull;

/**
 * Created by cattaneostefano on 13/02/2017.
 */

public class RecipeCooler {

    private final SharedPreferences mSharedPreferences;

    public static final String NEAR_RECIPECOOLER_PREFSNAME = "NearRecipeCoolerPrefsName";
    public static final String LOG_MAP = "LOG_MAP";
    public static final String LATEST_LOG = "LATEST_LOG";

    public static final String GLOBAL_COOLDOWN = "global_cooldown";
    public static final String SELF_COOLDOWN = "self_cooldown";

    private Map<String, Long> mRecipeLogMap;
    private Long mLatestLogEntry;

    public RecipeCooler(@NonNull SharedPreferences sharedPreferences) {
        mSharedPreferences = checkNotNull(sharedPreferences);;
    }

    public void markRecipeAsShown(String recipeId){
        long timeStamp = System.currentTimeMillis();
        getMap().put(recipeId, new Long(timeStamp));
        saveMap(mRecipeLogMap);
        saveLatestEntry(System.currentTimeMillis());

    }

    private boolean canShowRecipe(Recipe recipe){
        Map <String, Object> cooldown = recipe.getCooldown();
        return cooldown == null ||
                ( globalCooldownCheck(cooldown) && selfCooldownCheck(recipe, cooldown) );
    }

    private boolean globalCooldownCheck(Map<String, Object> cooldown) {
        if (!cooldown.containsKey(GLOBAL_COOLDOWN) ||
{'fraction_non_alphanumeric': 0.0901312036508842, 'fraction_numerical': 0.004563605248146035, 'mean_word_length': 4.180206794682422, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1785293', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1049, 'n_words': 228}