<commit_before>package org.mtransit.android.commons;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.ListIterator;
import java.util.Locale;

import org.mtransit.android.commons.data.Route;
import org.mtransit.android.commons.data.RouteTripStop;
import org.mtransit.android.commons.task.MTAsyncTask;

import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.text.TextUtils;

public class LocationUtils implements MTLog.Loggable {

	private static final String TAG = LocationUtils.class.getSimpleName();

	@Override
	public String getLogTag() {
		return TAG;
	}

	public static final long UPDATE_INTERVAL_IN_MS = 5 * TimeUtils.ONE_SECOND_IN_MS; // 5 seconds

	public static final long FASTEST_INTERVAL_IN_MS = TimeUtils.ONE_SECOND_IN_MS; // 1 second

	public static final long MIN_TIME = 2 * 1000; // 2 second

	public static final float MIN_DISTANCE = 5; // 5 meters

	public static final long PREFER_ACCURACY_OVER_TIME_IN_MS = 30 * TimeUtils.ONE_SECOND_IN_MS; // 30 seconds
	public static final int SIGNIFICANT_ACCURACY_IN_METERS = 200; // 200 meters

	public static final int SIGNIFICANT_DISTANCE_MOVED_IN_METERS = 5; // 5 meters

	public static final int ALMOST_SAME_LOCATION_DISTANCE_IN_METERS = 25; // 10; // 10 meters


	public static final double MIN_AROUND_DIFF = 0.01;
	public static final double INC_AROUND_DIFF = 0.01;

	public static final double MAX_AROUND_DIFF = 44; // 7.77; // 0.10;

	private static final String AROUND_TRUNC = "%.4g";

	public static float FEET_PER_M = 3.2808399f;

	public static float FEET_PER_MILE = 5280;

	public static float METER_PER_KM = 1000f;

	public static final int MIN_NEARBY_LIST = 10; // 10; // 0;

	public static final int MAX_NEARBY_LIST = 20; // 20; // 100; // 25;

	public static final int MAX_POI_NEARBY_POIS_LIST = 10;
	public static final int MIN_NEARBY_LIST_COVERAGE_IN_METERS = 500;

	public static final int MIN_POI_NEARBY_POIS_LIST_COVERAGE_IN_METERS = 100;


	public static AroundDiff getNewDefaultAroundDiff() {
		return new AroundDiff(LocationUtils.MIN_AROUND_DIFF, LocationUtils.INC_AROUND_DIFF);
	}

	private LocationUtils() {
	}

	/**
	 * @param location the location
	 * @return a nice readable location string
	 */
	public static String locationToString(Location location) {
		if (location == null) {
			return null;
		}
		return String.format("%s > %s,%s (%s) %s seconds ago", location.getProvider(), location.getLatitude(), location.getLongitude(), location.getAccuracy(),
				TimeUtils.millisToSec(TimeUtils.currentTimeMillis() - location.getTime()));
	}

	public static Location getNewLocation(double lat, double lng) {
		Location newLocation = new Location("MT");
		newLocation.setLatitude(lat);
		newLocation.setLongitude(lng);
		newLocation.setAccuracy(77f);
		return newLocation;
	}

	public static float bearTo(double startLatitude, double startLongitude, double endLatitude, double endLongitude) {
		float[] results = new float[2];
		Location.distanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, results);
		return results[1];
	}

	public static float distanceTo(Location start, Location end) {
		if (start == null || end == null) {
			return -1f;
		}
		return distanceTo(start.getLatitude(), start.getLongitude(), end.getLatitude(), end.getLongitude());
	}

	public static float distanceTo(double startLatitude, double startLongitude, double endLatitude, double endLongitude) {
		float[] results = new float[2];
		Location.distanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, results);
		return results[0];
	}
<commit_msg>Remove debug value for location accuracy.<commit_after>package org.mtransit.android.commons;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.ListIterator;
import java.util.Locale;

import org.mtransit.android.commons.data.Route;
import org.mtransit.android.commons.data.RouteTripStop;
import org.mtransit.android.commons.task.MTAsyncTask;

import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.text.TextUtils;

public class LocationUtils implements MTLog.Loggable {

	private static final String TAG = LocationUtils.class.getSimpleName();

	@Override
	public String getLogTag() {
		return TAG;
	}

	public static final long UPDATE_INTERVAL_IN_MS = 5 * TimeUtils.ONE_SECOND_IN_MS; // 5 seconds

	public static final long FASTEST_INTERVAL_IN_MS = TimeUtils.ONE_SECOND_IN_MS; // 1 second

	public static final long MIN_TIME = 2 * 1000; // 2 second

	public static final float MIN_DISTANCE = 5; // 5 meters

	public static final long PREFER_ACCURACY_OVER_TIME_IN_MS = 30 * TimeUtils.ONE_SECOND_IN_MS; // 30 seconds
	public static final int SIGNIFICANT_ACCURACY_IN_METERS = 200; // 200 meters

	public static final int SIGNIFICANT_DISTANCE_MOVED_IN_METERS = 5; // 5 meters

	public static final int ALMOST_SAME_LOCATION_DISTANCE_IN_METERS = 25; // 10; // 10 meters


	public static final double MIN_AROUND_DIFF = 0.01;
	public static final double INC_AROUND_DIFF = 0.01;

	public static final double MAX_AROUND_DIFF = 44; // 7.77; // 0.10;

	private static final String AROUND_TRUNC = "%.4g";

	public static float FEET_PER_M = 3.2808399f;

	public static float FEET_PER_MILE = 5280;

	public static float METER_PER_KM = 1000f;

	public static final int MIN_NEARBY_LIST = 10; // 10; // 0;

	public static final int MAX_NEARBY_LIST = 20; // 20; // 100; // 25;

	public static final int MAX_POI_NEARBY_POIS_LIST = 10;
	public static final int MIN_NEARBY_LIST_COVERAGE_IN_METERS = 500;

	public static final int MIN_POI_NEARBY_POIS_LIST_COVERAGE_IN_METERS = 100;


	public static AroundDiff getNewDefaultAroundDiff() {
		return new AroundDiff(LocationUtils.MIN_AROUND_DIFF, LocationUtils.INC_AROUND_DIFF);
	}

	private LocationUtils() {
	}

	/**
	 * @param location the location
	 * @return a nice readable location string
	 */
	public static String locationToString(Location location) {
		if (location == null) {
			return null;
		}
		return String.format("%s > %s,%s (%s) %s seconds ago", location.getProvider(), location.getLatitude(), location.getLongitude(), location.getAccuracy(),
				TimeUtils.millisToSec(TimeUtils.currentTimeMillis() - location.getTime()));
	}

	public static Location getNewLocation(double lat, double lng) {
		Location newLocation = new Location("MT");
		newLocation.setLatitude(lat);
		newLocation.setLongitude(lng);
		return newLocation;
	}

	public static float bearTo(double startLatitude, double startLongitude, double endLatitude, double endLongitude) {
		float[] results = new float[2];
		Location.distanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, results);
		return results[1];
	}

	public static float distanceTo(Location start, Location end) {
		if (start == null || end == null) {
			return -1f;
		}
		return distanceTo(start.getLatitude(), start.getLongitude(), end.getLatitude(), end.getLongitude());
	}

	public static float distanceTo(double startLatitude, double startLongitude, double endLatitude, double endLongitude) {
		float[] results = new float[2];
		Location.distanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, results);
		return results[0];
	}

{'fraction_non_alphanumeric': 0.09395360959082617, 'fraction_numerical': 0.02293458431065937, 'mean_word_length': 5.029065200314219, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2008044', 'n_tokens_mistral': 2711, 'n_tokens_neox': 2401, 'n_words': 646}