<commit_before>package com.morristaedt.mirror.modules;

import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;

import java.net.MalformedURLException;
import java.lang.StringBuilder;
import java.net.URLConnection;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.FileReader;
import java.net.URL;
import java.net.HttpURLConnection;
import java.util.Calendar;

import com.google.gson.JsonElement;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import com.morristaedt.mirror.configuration.ConfigurationSettings;
import com.morristaedt.mirror.requests.XKCDRequest;
import com.morristaedt.mirror.requests.XKCDResponse;

import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import retrofit.RestAdapter;
import retrofit.RetrofitError;

/**
 * Created by Lee on 4/24/2016.
 */
public class SeptaModule {

    private final String TAG = "SeptaModule";
    private static String textAlert;
    private String routeID;                     //TODO Assigned in settings
    private String nextFiveArrivals;            // Next five arrivals

    public interface SeptaListener {
        void onNewAlert(String SeptaAlert);
    }

    public static void getSingleAlert(final SeptaListener septaListener) {
        final String TAG = "SeptaAsyncModule";
        new AsyncTask<Void, Void, String>() {
            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                septaListener.onNewAlert(s);
            }

            @Override
            protected String doInBackground(Void... params) {
                try {
                    Document doc = Jsoup.connect("http://www.septa.org/realtime/alert.html").get();
                    textAlert = doc.text();
                    String removeText = "For current updates on all routes go to System Status.";

                    textAlert = textAlert.replace(removeText, "");
                    return textAlert;
                } catch (Exception err) {
                    Log.d(TAG, "Single Alert exception thrown: " + err);
                    return null;
                }
            }
        }.execute();
    }
}<commit_msg>Add comments to SeptaModule<commit_after>package com.morristaedt.mirror.modules;

import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;

import java.net.MalformedURLException;
import java.lang.StringBuilder;
import java.net.URLConnection;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.FileReader;
import java.net.URL;
import java.net.HttpURLConnection;
import java.util.Calendar;

import com.google.gson.JsonElement;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import com.morristaedt.mirror.configuration.ConfigurationSettings;
import com.morristaedt.mirror.requests.XKCDRequest;
import com.morristaedt.mirror.requests.XKCDResponse;

import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import retrofit.RestAdapter;
import retrofit.RetrofitError;

/**
 * Created by Lee on 4/24/2016.
 */
public class SeptaModule {

    private static String textAlert;            //Alert information from Septa
    private String routeID;                     //TODO Assigned in settings
    private String nextFiveArrivals;            // Next five arrivals

    //Updates when new alert received
    public interface SeptaListener {
        void onNewAlert(String SeptaAlert);
    }

    //Returns travel alert information from septa
    public static void getTravelAlert(final SeptaListener septaListener) {
        final String TAG = "SeptaAsyncModule"; //Use to log error message

        //Start UI thread for background operations
        new AsyncTask<Void, Void, String>() {
            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                septaListener.onNewAlert(s);
            }

            @Override
            protected String doInBackground(Void... params) {
                try {
                    //Uses Jsoup to connect to septa and pulls text off webpage
                    Document doc = Jsoup.connect("http://www.septa.org/realtime/alert.html").get();
                    //Coverts the document to string
                    textAlert = doc.text();
                    //Removes generic text from text
                    textAlert = textAlert.replace("For current updates on all routes go to System Status.", "");
                    return textAlert;
                } catch (Exception err) {
                    Log.d(TAG, "Single Alert exception thrown: " + err);
                    return null;
                }
            }
        }.execute();
    }
}
{'fraction_non_alphanumeric': 0.08898224174145503, 'fraction_numerical': 0.002673286232575902, 'mean_word_length': 2.5154362416107383, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3019701', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1399, 'n_words': 354}