<commit_before>package com.thebluealliance.androidclient.helpers;

import android.util.Log;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.thebluealliance.androidclient.Constants;
import com.thebluealliance.androidclient.models.District;

import java.util.Map;
import java.util.Set;

/**
 * Created by phil on 7/24/14.
 */
public class DistrictHelper {

    /* DO NOT CHANGE ORDER. */
    public static enum DISTRICTS {
        NO_DISTRICT,
        MICHIGAN,
        MID_ATLANTIC,
        NEW_ENGLAND,
        PACIFIC_NORTHWEST;

        public static DISTRICTS fromEnum(int districtEnum){
            switch (districtEnum){
                default:
                case 0: return NO_DISTRICT;
                case 1: return MICHIGAN;
                case 2: return MID_ATLANTIC;
                case 3: return NEW_ENGLAND;
                case 4: return PACIFIC_NORTHWEST;
            }
        }

        public static DISTRICTS fromAbbreviation(String abbrev){
            switch (abbrev){
                case "fim": return MICHIGAN;
                case "mar": return MID_ATLANTIC;
                case "ne":  return NEW_ENGLAND;
                case "pnw": return PACIFIC_NORTHWEST;
                default:    return NO_DISTRICT;
            }
        }

        public String getName(){
            switch (this){
                default:
                case NO_DISTRICT: return "";
                case MICHIGAN: return "Michigan";
                case MID_ATLANTIC: return "Mid Atlantic";
                case NEW_ENGLAND: return "New England";
                case PACIFIC_NORTHWEST: return "Pacific Northwest";
            }
        }

        public String getAbbreviation(){
            switch (this){
                default:
                case NO_DISTRICT: return "";
                case MICHIGAN: return "fim";
                case MID_ATLANTIC: return "mar";
                case NEW_ENGLAND: return "ne";
                case PACIFIC_NORTHWEST: return "pnw";
            }
        }

    }

    public static boolean validateDistrictKey(String key){
        try {
            int year = Integer.parseInt(key.substring(0, 4));
            String districtAbbrev = key.substring(4);
            return DISTRICTS.fromAbbreviation(districtAbbrev) != DISTRICTS.NO_DISTRICT;
        }catch (NumberFormatException e){
            return false;
        }
    }

    public static String generateKey(String districtAbbrev, int year){
        return year + districtAbbrev;<commit_msg>add support for Indiana district<commit_after>package com.thebluealliance.androidclient.helpers;

import android.util.Log;

import com.google.gson.JsonObject;
import com.thebluealliance.androidclient.Constants;
import com.thebluealliance.androidclient.models.District;

/**
 * Created by phil on 7/24/14.
 */
public class DistrictHelper {

    /* DO NOT CHANGE ORDER. */
    public static enum DISTRICTS {
        NO_DISTRICT,
        MICHIGAN,
        MID_ATLANTIC,
        NEW_ENGLAND,
        PACIFIC_NORTHWEST,
        INDIANA;

        public static DISTRICTS fromEnum(int districtEnum){
            switch (districtEnum){
                default:
                case 0: return NO_DISTRICT;
                case 1: return MICHIGAN;
                case 2: return MID_ATLANTIC;
                case 3: return NEW_ENGLAND;
                case 4: return PACIFIC_NORTHWEST;
                case 5: return INDIANA;
            }
        }

        public static DISTRICTS fromAbbreviation(String abbrev){
            switch (abbrev){
                case "fim": return MICHIGAN;
                case "mar": return MID_ATLANTIC;
                case "ne":  return NEW_ENGLAND;
                case "pnw": return PACIFIC_NORTHWEST;
                case "in":  return INDIANA;
                default:    return NO_DISTRICT;
            }
        }

        public String getName(){
            switch (this){
                default:
                case NO_DISTRICT: return "";
                case MICHIGAN: return "Michigan";
                case MID_ATLANTIC: return "Mid Atlantic";
                case NEW_ENGLAND: return "New England";
                case PACIFIC_NORTHWEST: return "Pacific Northwest";
                case INDIANA: return "Indiana";
            }
        }

        public String getAbbreviation(){
            switch (this){
                default:
                case NO_DISTRICT: return "";
                case MICHIGAN: return "fim";
                case MID_ATLANTIC: return "mar";
                case NEW_ENGLAND: return "ne";
                case PACIFIC_NORTHWEST: return "pnw";
                case INDIANA: return "in";
            }
        }

    }

    public static boolean validateDistrictKey(String key){
        try {
            int year = Integer.parseInt(key.substring(0, 4));
            String districtAbbrev = key.substring(4);
            return DISTRICTS.fromAbbreviation(districtAbbrev) != DISTRICTS.NO_DISTRICT;
        }catch (NumberFormatException e){
            return false;
        }
    }

    public static String generateKey(String districtAbbrev, int year){
        return year + districtAbbrev;
{'fraction_non_alphanumeric': 0.0764343473238352, 'fraction_numerical': 0.005198305737389296, 'mean_word_length': 1.6931052358735097, 'pattern_counts': {'":': 9, '<': 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': '4673689', 'n_tokens_mistral': 1589, 'n_tokens_neox': 1375, 'n_words': 364}