// Path: app/src/main/java/com/YC2010/MyClass/utils/Constants.java
// public class Constants {
//     public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/";
//     public static List<Reminder_item> holiday_2015;
//     public static List<Reminder_item> sample_reminder;
// 
//     public static String lectureSectionObjectListKey = "LEC_OBJECTS";
//     public static String testObjectListKey = "TST_OBJECTS";
//     public static String tutorialObjectListKey = "TUT_OBJECTS";
//     public static String finalObjectListKey = "FINAL_OBJECTS";
// 
//     // default term value
//     public static Integer defaultCurTermNum = 1161;
//     public static String defaultCurTermName = "Winter 2016 (Current)";
//     public static Integer defaultNextTermNum = 1165;
//     public static String defaultNextTermName = "Spring 2016 (Next)";
// 
//     // temporarily hardcoded
//     // Note: month off by one because of unix time standard
//     public static GregorianCalendar nextTermStartDate = new GregorianCalendar(2016, 4, 2);
// 
// 
// 
//     public static List<Reminder_item> get_sample_reminder(){
//         sample_reminder = new ArrayList<>();
//         Reminder_item tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Final end","", 2015, 7, 15, "d");
//         sample_reminder.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Next term start","", 2015, 8, 14, "d");
//         sample_reminder.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "First penalty end","", 2015, 9, 3, "d");
//         sample_reminder.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Late fee for fall","", 2015, 7, 28, "d");
//         sample_reminder.add(tmp);
// 
//         return sample_reminder;
//     }
// 
//     public static List<Reminder_item> get_holidays(){
//         holiday_2015 = new ArrayList<>();
//         Reminder_item tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Civic Holiday","", 2015, 7, 3, "d");
//         holiday_2015.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Labour Day","", 2015, 8, 7, "d");
//         holiday_2015.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Thanksgiving","", 2015, 9, 12, "d");
//         holiday_2015.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Christmas","", 2015, 11, 25, "d");
//         holiday_2015.add(tmp);
// 
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Boxing Day","", 2015, 11, 28, "d");
//         holiday_2015.add(tmp);
// 
//         return holiday_2015;
//     }
// }


import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import com.YC2010.MyClass.utils.Constants;
import com.YC2010.MyClass.utils.Tools;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
package com.YC2010.MyClass.data;





/**
 * Created by Danny on 2015/10/25.
 */
public class Connections {

    // /courses/{subject}/{catalog_number}

    public static String getCourseInfoURL(String input) {
        String subject = "";
        String cataNum = "";
        boolean isCoursePrefix = true;

        input = input.replaceAll("\\s+","");

        for (int i = 0; i < input.length(); i++) {
            if(isCoursePrefix && Character.isDigit(input.charAt(i)))
                isCoursePrefix = false;
            if(isCoursePrefix){
                subject += input.charAt(i);
            }
            else{
                cataNum += input.charAt(i);
            }
        }

// Path: app/src/main/java/com/YC2010/MyClass/utils/Constants.java
// public class Constants {
//     public static String UWAPIROOT = "https://api.uwaterloo.ca/v2/";
//     public static List<Reminder_item> holiday_2015;
//     public static List<Reminder_item> sample_reminder;
// 
//     public static String lectureSectionObjectListKey = "LEC_OBJECTS";
//     public static String testObjectListKey = "TST_OBJECTS";
//     public static String tutorialObjectListKey = "TUT_OBJECTS";
//     public static String finalObjectListKey = "FINAL_OBJECTS";
// 
//     // default term value
//     public static Integer defaultCurTermNum = 1161;
//     public static String defaultCurTermName = "Winter 2016 (Current)";
//     public static Integer defaultNextTermNum = 1165;
//     public static String defaultNextTermName = "Spring 2016 (Next)";
// 
//     // temporarily hardcoded
//     // Note: month off by one because of unix time standard
//     public static GregorianCalendar nextTermStartDate = new GregorianCalendar(2016, 4, 2);
// 
// 
// 
//     public static List<Reminder_item> get_sample_reminder(){
//         sample_reminder = new ArrayList<>();
//         Reminder_item tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Final end","", 2015, 7, 15, "d");
//         sample_reminder.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Next term start","", 2015, 8, 14, "d");
//         sample_reminder.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "First penalty end","", 2015, 9, 3, "d");
//         sample_reminder.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Late fee for fall","", 2015, 7, 28, "d");
//         sample_reminder.add(tmp);
// 
//         return sample_reminder;
//     }
// 
//     public static List<Reminder_item> get_holidays(){
//         holiday_2015 = new ArrayList<>();
//         Reminder_item tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Civic Holiday","", 2015, 7, 3, "d");
//         holiday_2015.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Labour Day","", 2015, 8, 7, "d");
//         holiday_2015.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Thanksgiving","", 2015, 9, 12, "d");
//         holiday_2015.add(tmp);
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Christmas","", 2015, 11, 25, "d");
//         holiday_2015.add(tmp);
// 
//         tmp = new Reminder_item(UUID.randomUUID().toString(),
//                 "Boxing Day","", 2015, 11, 28, "d");
//         holiday_2015.add(tmp);
// 
//         return holiday_2015;
//     }
// }


// Path: app/src/main/java/com/YC2010/MyClass/data/Connections.java
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import com.YC2010.MyClass.utils.Constants;
import com.YC2010.MyClass.utils.Tools;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

package com.YC2010.MyClass.data;





/**
 * Created by Danny on 2015/10/25.
 */
public class Connections {

    // /courses/{subject}/{catalog_number}

    public static String getCourseInfoURL(String input) {
        String subject = "";
        String cataNum = "";
        boolean isCoursePrefix = true;

        input = input.replaceAll("\\s+","");

        for (int i = 0; i < input.length(); i++) {
            if(isCoursePrefix && Character.isDigit(input.charAt(i)))
                isCoursePrefix = false;
            if(isCoursePrefix){
                subject += input.charAt(i);
            }
            else{
                cataNum += input.charAt(i);
            }
        }

        return Constants.UWAPIROOT + "courses/" + subject + "/" + cataNum + ".json" + URLEnding();