<commit_before>package org.commcare.preferences;

import android.content.Context;
import android.content.SharedPreferences;

import org.commcare.CommCareApplication;
import org.commcare.logging.analytics.GoogleAnalyticsUtils;

import java.util.ArrayList;

/**
 * Manages privileges that are global to a device running CommCare, rather than a specific app
 *
 * @author <NAME> (<EMAIL>), created 6/9/16.
 */
public class GlobalPrivilegesManager {

    private static final String GLOBAL_PRIVELEGES_FILENAME = "global-preferences-filename";

    public static final String PRIVILEGE_MULTIPLE_APPS = "multiple_apps_unlimited";

    public static final ArrayList<String> allGlobalPrivilegesList = new ArrayList<>();
    static {
        allGlobalPrivilegesList.add(PRIVILEGE_MULTIPLE_APPS);
    }

    private static SharedPreferences getGlobalPrivilegesRecord() {
        return CommCareApplication._().getSharedPreferences(GLOBAL_PRIVELEGES_FILENAME,
                Context.MODE_PRIVATE);
    }

    /**
     * @param username - the HQ web user associated with the privilege being granted
     */
    public static void enablePrivilege(String privilegeName, String username) {
        getGlobalPrivilegesRecord().edit().putBoolean(privilegeName, true).commit();
        GoogleAnalyticsUtils.reportPrivilegeEnabled(privilegeName, username);
    }

    public static void disablePrivilege(String privilegeName) {
        getGlobalPrivilegesRecord().edit().putBoolean(privilegeName, false).commit();
    }

    public static ArrayList<String> getEnabledPrivileges() {
        ArrayList<String> privilegesEnabled = new ArrayList<>();
        for (String privilege : allGlobalPrivilegesList) {
            if (isPrivilegeEnabled(privilege)) {
                privilegesEnabled.add(privilege);
            }
        }
        return privilegesEnabled;
    }

    public static String getEnabledPrivilegesString() {
        StringBuilder builder = new StringBuilder();
        for (String privilege : getEnabledPrivileges()) {
            builder.append("- " + getPrivilegeDisplayName(privilege) +"\n");
        }
        return builder.toString();
    }<commit_msg>use chained append calls instead of +<commit_after>package org.commcare.preferences;

import android.content.Context;
import android.content.SharedPreferences;

import org.commcare.CommCareApplication;
import org.commcare.logging.analytics.GoogleAnalyticsUtils;

import java.util.ArrayList;

/**
 * Manages privileges that are global to a device running CommCare, rather than a specific app
 *
 * @author <NAME> (<EMAIL>), created 6/9/16.
 */
public class GlobalPrivilegesManager {

    private static final String GLOBAL_PRIVELEGES_FILENAME = "global-preferences-filename";

    public static final String PRIVILEGE_MULTIPLE_APPS = "multiple_apps_unlimited";

    public static final ArrayList<String> allGlobalPrivilegesList = new ArrayList<>();
    static {
        allGlobalPrivilegesList.add(PRIVILEGE_MULTIPLE_APPS);
    }

    private static SharedPreferences getGlobalPrivilegesRecord() {
        return CommCareApplication._().getSharedPreferences(GLOBAL_PRIVELEGES_FILENAME,
                Context.MODE_PRIVATE);
    }

    /**
     * @param username - the HQ web user associated with the privilege being granted
     */
    public static void enablePrivilege(String privilegeName, String username) {
        getGlobalPrivilegesRecord().edit().putBoolean(privilegeName, true).commit();
        GoogleAnalyticsUtils.reportPrivilegeEnabled(privilegeName, username);
    }

    public static void disablePrivilege(String privilegeName) {
        getGlobalPrivilegesRecord().edit().putBoolean(privilegeName, false).commit();
    }

    public static ArrayList<String> getEnabledPrivileges() {
        ArrayList<String> privilegesEnabled = new ArrayList<>();
        for (String privilege : allGlobalPrivilegesList) {
            if (isPrivilegeEnabled(privilege)) {
                privilegesEnabled.add(privilege);
            }
        }
        return privilegesEnabled;
    }

    public static String getEnabledPrivilegesString() {
        StringBuilder builder = new StringBuilder();
        for (String privilege : getEnabledPrivileges()) {
            builder.append("- ").append(getPrivilegeDisplayName(privilege)).append("\n");
        }
        return builder.toString();
    }
{'fraction_non_alphanumeric': 0.08936365724787503, 'fraction_numerical': 0.001837813002526993, 'mean_word_length': 3.6517094017094016, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '3631551', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1140, 'n_words': 259}