<commit_before>package com.reactnativenavigation.core.objects;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.MenuItem;

import com.facebook.react.bridge.ReadableMap;
import com.reactnativenavigation.utils.IconUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by guyc on 08/04/16.
 */
public class Button extends JsonObject implements Serializable {
    private static final long serialVersionUID = -570145217281069067L;

    private static final String KEY_ID = "id";
    private static final String KEY_TITLE = "title";
    private static final String KEY_ICON = "icon";
    private static final String KEY_DISABLED = "disabled";

    public String id;
    public String title;
    private String mIconSource;
    public boolean disabled;

    private static final AtomicInteger sAtomicIdGenerator = new AtomicInteger();
    private static final Map<String, Integer> sStringToNumericId = new HashMap<>();

    public Button(ReadableMap button) {
        id = getString(button, KEY_ID);
        title = getString(button, KEY_TITLE, "");
        mIconSource = getString(button, KEY_ICON);
        disabled = getBoolean(button, KEY_DISABLED);
    }

    public boolean hasIcon() {
        return mIconSource != null;
    }

    /**
     * @param dimensions The requested icon dimensions
     */
    public Drawable getIcon(Context ctx, int dimensions) {
       return IconUtils.getIcon(ctx, mIconSource, dimensions);
    }

    public int getItemId() {
        if (sStringToNumericId.containsKey(id)) {
            return sStringToNumericId.get(id);
        }

        int itemId = sAtomicIdGenerator.addAndGet(1);
        sStringToNumericId.put(id, itemId);
        return itemId;
    }

    /**
     * Each button has a string id, defined in JS, which is used to identify the button when
     * handling events.
     * @param item Toolbar button
     * @return Returns the event id associated with the given menu item
     */
    public static String getButtonEventId(MenuItem item) {
        for (Map.Entry<String, Integer> entry : sStringToNumericId.entrySet()) {
            if (entry.getValue() == item.getItemId()) {
                return entry.getKey();
            }
        }

        return null;
    }
}
<commit_msg>Add missing files<commit_after>package com.reactnativenavigation.core.objects;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.MenuItem;

import com.facebook.react.bridge.ReadableMap;
import com.reactnativenavigation.utils.IconUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by guyc on 08/04/16.
 */
public class Button extends JsonObject implements Serializable {
    private static final long serialVersionUID = -570145217281069067L;

    private static final String KEY_ID = "id";
    private static final String KEY_TITLE = "title";
    private static final String KEY_ICON = "icon";
    private static final String KEY_DISABLED = "disabled";
    private static final String KEY_SHOW_AS_ACTION = "showAsAction";

    public String id;
    public String title;
    private String mIconSource;
    public boolean disabled;
    public String showAsAction;

    private static final AtomicInteger sAtomicIdGenerator = new AtomicInteger();
    private static final Map<String, Integer> sStringToNumericId = new HashMap<>();

    public Button(ReadableMap button) {
        id = getString(button, KEY_ID);
        title = getString(button, KEY_TITLE, "");
        mIconSource = getString(button, KEY_ICON);
        disabled = getBoolean(button, KEY_DISABLED);
        showAsAction = getString(button, KEY_SHOW_AS_ACTION, "");
    }

    public boolean hasIcon() {
        return mIconSource != null;
    }

    /**
     * @param dimensions The requested icon dimensions
     */
    public Drawable getIcon(Context ctx, int dimensions) {
       return IconUtils.getIcon(ctx, mIconSource, dimensions);
    }

    public int getItemId() {
        if (sStringToNumericId.containsKey(id)) {
            return sStringToNumericId.get(id);
        }

        int itemId = sAtomicIdGenerator.addAndGet(1);
        sStringToNumericId.put(id, itemId);
        return itemId;
    }

    /**
     * Each button has a string id, defined in JS, which is used to identify the button when
     * handling events.
     * @param item Toolbar button
     * @return Returns the event id associated with the given menu item
     */
    public static String getButtonEventId(MenuItem item) {
        for (Map.Entry<String, Integer> entry : sStringToNumericId.entrySet()) {
            if (entry.getValue() == item.getItemId()) {
                return entry.getKey();
            }
        }

        return null;
    }
}

{'fraction_non_alphanumeric': 0.08869494621473513, 'fraction_numerical': 0.010148163182463974, 'mean_word_length': 3.0526315789473686, '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': '3525553', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1370, 'n_words': 396}