<commit_before>package com.cantrowitz.rxbroadcast;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;

import rx.Observable;

/**
 * Created by adamcantrowitz on 9/1/15.
 */
public class RxBroadcast {

    public static Observable<Intent> fromBroadcast(Context context, IntentFilter intentFilter) {
        return Observable.create(new GlobalBroadcastProvider(intentFilter, context));
    }

    public static Observable<Intent> fromBroadcast(Context context, IntentFilter intentFilter,
                                                   String broadcastPermission, Handler handler) {
        return Observable.create(new GlobalWPermissionsBroadcastProvider(intentFilter, context,
                broadcastPermission, handler));
    }

    public static Observable<Intent> fromLocalBroadcast(Context context, IntentFilter intentFilter) {
        return Observable.create(new LocalBroadcastProvider(intentFilter,
                LocalBroadcastManager.getInstance(context)));
    }
}<commit_msg>added java docs<commit_after>package com.cantrowitz.rxbroadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;

import rx.Observable;

/**
 * Created by adamcantrowitz on 9/1/15.
 */
public class RxBroadcast {

    private RxBroadcast() {
        throw new AssertionError("No instances");
    }

    /**
     * Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
     *
     * @param context the context the {@link BroadcastReceiver} will be created from
     * @param intentFilter the filter for the particular intent
     * @return Observable of {@link Intent} that matches the filter
     */
    public static Observable<Intent> fromBroadcast(Context context, IntentFilter intentFilter) {
        return Observable.create(new GlobalBroadcastProvider(intentFilter, context));
    }

    /**
     *  Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
     * @param context the context the {@link BroadcastReceiver} will be created from
     * @param intentFilter the filter for the particular intent
     * @param broadcastPermission String naming a permissions that a broadcaster must hold in order to send an Intent to you. If null, no permission is required.
     * @param handler Handler identifying the thread that will receive the Intent. If null, the main thread of the process will be used.
     * @return
     */
    public static Observable<Intent> fromBroadcast(Context context, IntentFilter intentFilter,
                                                   String broadcastPermission, Handler handler) {
        return Observable.create(new GlobalWPermissionsBroadcastProvider(intentFilter, context,
                broadcastPermission, handler));
    }
    /**
     * Create {@link Observable} that wraps {@link BroadcastReceiver} and emits received intents.
     * <p>
     *  This uses a {@link LocalBroadcastManager}
     * @param context the context the {@link BroadcastReceiver} will be created from
     * @param intentFilter the filter for the particular intent
     * @return Observable of {@link Intent} that matches the filter
     */
    public static Observable<Intent> fromLocalBroadcast(Context context, IntentFilter intentFilter) {
        return Observable.create(new LocalBroadcastProvider(intentFilter,
                LocalBroadcastManager.getInstance(context)));
    }
}
{'fraction_non_alphanumeric': 0.07371273712737128, 'fraction_numerical': 0.0027100271002710027, 'mean_word_length': 3.5511713933415536, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5528391', 'n_tokens_mistral': 890, 'n_tokens_neox': 866, 'n_words': 294}