<commit_before>package org.mindapps.paatupaadava;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.NetworkInfo;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager.PeerListListener;
import android.util.Log;

public class WifiBroadcastReceiver extends BroadcastReceiver {

    private WifiP2pManager manager;
    private final WifiP2pManager.Channel channel;
    private PeerListListener peerListListener = new PeerList();
    private NetworkInfo networkInfo;

    public boolean isConnected() {
        return networkInfo.isConnected();
    }

    public WifiBroadcastReceiver(WifiP2pManager manager, WifiP2pManager.Channel channel) {
        this.manager = manager;
        this.channel = channel;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {

        } else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
            if (manager != null) {
                Log.i("App-log", "P2P Change Happened");
                manager.requestPeers(channel, peerListListener);
            }
        } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {
            Log.i("App-log", "Wifi P2P Connection changed action. Network info");

            if (manager != null) {
                this.networkInfo = intent
                        .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
            }

        } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
            Log.i("App-log", "Wifi P2P this device changed");
        }
    }
}
<commit_msg>[Aswin] - Switch instead of if-else ladder<commit_after>package org.mindapps.paatupaadava;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.NetworkInfo;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager.PeerListListener;
import android.util.Log;

public class WifiBroadcastReceiver extends BroadcastReceiver {

    private WifiP2pManager manager;
    private final WifiP2pManager.Channel channel;
    private PeerListListener peerListListener = new PeerList();
    private NetworkInfo networkInfo;

    public boolean isConnected() {
        return networkInfo.isConnected();
    }

    public WifiBroadcastReceiver(WifiP2pManager manager, WifiP2pManager.Channel channel) {
        this.manager = manager;
        this.channel = channel;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        switch (action) {
            case WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION:

                break;
            case WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION:
                if (manager != null) {
                    Log.i("App-log", "P2P Change Happened");
                    manager.requestPeers(channel, peerListListener);
                }
                break;
            case WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION:
                Log.i("App-log", "Wifi P2P Connection changed action. Network info");

                if (manager != null) {
                    this.networkInfo = intent
                            .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
                }

                break;
            case WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION:
                Log.i("App-log", "Wifi P2P this device changed");
                break;
        }
    }
}

{'fraction_non_alphanumeric': 0.08342361863488625, 'fraction_numerical': 0.010834236186348862, 'mean_word_length': 2.6348425196850394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1374162', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1094, 'n_words': 208}