<commit_before>package io.trewartha.positional;

import android.location.Location;
import android.support.annotation.NonNull;

class UnitConverter {

    private static final double FEET_PER_METER = 3.2808399200439453;
    private static final double MPH_PER_MPS = 0.44704;

    static double metersToFeet(double meters) {
        return meters * FEET_PER_METER;
    }

    static double metersPerSecondToMilesPerHour(double metersPerSecond) {
        return metersPerSecond * MPH_PER_MPS;
    }

    @NonNull
    static String getLatitudeAsDMS(@NonNull Location location, int decimalPlaces) {
        String latitude = Location.convert(location.getLatitude(), Location.FORMAT_SECONDS);
        latitude = replaceDelimiters(latitude, decimalPlaces);
        latitude = latitude + " N";
        return latitude;
    }

    @NonNull
    static String getLongitudeAsDMS(@NonNull Location location, int decimalPlaces) {
        String longitude = Location.convert(location.getLongitude(), Location.FORMAT_SECONDS);
        longitude = replaceDelimiters(longitude, decimalPlaces);
        longitude = longitude + " W";
        return longitude;
    }

    @NonNull
    private static String replaceDelimiters(String string, int decimalPlace) {
        string = string.replaceFirst(":", "° ");
        string = string.replaceFirst(":", "' ");
        int pointIndex = string.indexOf(".");
        int endIndex = pointIndex + 1 + decimalPlace;
        if (endIndex < string.length()) {
            string = string.substring(0, endIndex);
        }
        string = string + "\"";
        return string;
    }
}
<commit_msg>Use S and E instead of -N and -W for DMS coordinates<commit_after>package io.trewartha.positional;

import android.location.Location;
import android.support.annotation.NonNull;

class UnitConverter {

    private static final double FEET_PER_METER = 3.2808399200439453;
    private static final double MPH_PER_MPS = 0.44704;

    static double metersToFeet(double meters) {
        return meters * FEET_PER_METER;
    }

    static double metersPerSecondToMilesPerHour(double metersPerSecond) {
        return metersPerSecond * MPH_PER_MPS;
    }

    @NonNull
    static String getLatitudeAsDMS(@NonNull Location location, int decimalPlaces) {
        final double latitude = location.getLatitude();
        String latitudeDMS = Location.convert(latitude, Location.FORMAT_SECONDS);
        latitudeDMS = replaceDelimiters(latitudeDMS, decimalPlaces);
        if (latitude >= 0.0) {
            latitudeDMS = latitudeDMS + " N";
        } else {
            latitudeDMS = latitudeDMS.replaceFirst("-", "") + " S";
        }
        return latitudeDMS;
    }

    @NonNull
    static String getLongitudeAsDMS(@NonNull Location location, int decimalPlaces) {
        final double longitude = location.getLongitude();
        String longitudeDMS = Location.convert(longitude, Location.FORMAT_SECONDS);
        longitudeDMS = replaceDelimiters(longitudeDMS, decimalPlaces);
        if (longitude >= 0.0) {
            longitudeDMS = longitudeDMS + " E";
        } else {
            longitudeDMS = longitudeDMS.replaceFirst("-", "") + " W";
        }
        return longitudeDMS;
    }

    @NonNull
    private static String replaceDelimiters(String string, int decimalPlace) {
        string = string.replaceFirst(":", "° ");
        string = string.replaceFirst(":", "' ");
        int pointIndex = string.indexOf(".");
        int endIndex = pointIndex + 1 + decimalPlace;
        if (endIndex < string.length()) {
            string = string.substring(0, endIndex);
        }
        string = string + "\"";
        return string;
    }
}

{'fraction_non_alphanumeric': 0.09792122538293217, 'fraction_numerical': 0.01477024070021882, 'mean_word_length': 2.8739406779661016, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, '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': '1085800', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1032, 'n_words': 243}