<commit_before>package cgeo.geocaching.geopoint;

import android.location.Location;

/**
 * Abstraction of geographic point.
 */
public final class Geopoint
{
	public static final double kmInMiles = 1 / 1.609344;
	public static final double deg2rad   = Math.PI / 180;
	public static final double rad2deg   = 180 / Math.PI;
	public static final float  erad      = 6371.0f;

	private double latitude;
	private double longitude;

	/**
	 * Creates new Geopoint with given latitude and longitude (both degree).
	 *
	 * @param lat latitude
	 * @param lon longitude
	 */
	public Geopoint(final double lat, final double lon)
	{
		setLatitude(lat);
		setLongitude(lon);
	}

	/**
	 * Creates new Geopoint with given latitude and longitude (both microdegree).
	 *
	 * @param lat latitude
	 * @param lon longitude
	 */
	public Geopoint(final int lat, final int lon)
	{
		setLatitude(lat * 1E-6);
		setLongitude(lon * 1E-6);
	}

	/**
	 * Creates new Geopoint with latitude and longitude parsed from string.
	 *
	 * @param text string to parse
	 * @see GeopointParser.parse()
	 */
	public Geopoint(final String text)
	{
		setLatitude(GeopointParser.parseLatitude(text));
		setLongitude(GeopointParser.parseLongitude(text));
	}

	/**
	 * Creates new Geopoint with given Geopoint. This is similar to clone().
	 *
	 * @param gp the Geopoint to clone
	 */
	public Geopoint(final Geopoint gp)
	{
		this(gp.getLatitude(), gp.getLongitude());
	}

	/**
	 * Creates new Geopoint with given Location.
	 *
	 * @param gp the Location to clone
	 */
	public Geopoint(final Location loc) {
		this(loc.getLatitude(), loc.getLongitude());
	}

	/**
	 * Set latitude in degree.
	 *
	 * @param lat latitude
	 * @return this
	 * @throws MalformedCoordinateException if not -90 <= lat <= 90
	 */
	private void setLatitude(final double lat)
	{
		if (lat <= 90 && lat >= -90)
		{
			latitude  = lat;
		}
		else
		{
			throw new MalformedCoordinateException("malformed latitude: " + lat);
		}
	}

	/**
	 * Get latitude in degree.
	 *
	 * @return latitude
	 */
	public double getLatitude()
	{
		return latitude;
	}

	/**
	 * Get latitude in microdegree.
	 *
	 * @return latitude
	 */
	public int getLatitudeE6()
	{
		return (int) (latitude * 1E6);
	}

	/**
	 * Set longitude in degree.
	 *
	 * @param lon longitude
	 * @return this
	 * @throws MalformedCoordinateException if not -180 <= lon <= 180
	 */
	private void setLongitude(final double lon)
	{
		if (lon <= 180 && lon >=-180)
		{
			longitude = lon;
		}
		else
		{
			throw new MalformedCoordinateException("malformed longitude: " + lon);
		}
	}

	/**
	 * Get longitude in degree.
	 *
	 * @return longitude
	 */
	public double getLongitude()
	{
		return longitude;
	}

	/**
	 * Get longitude in microdegree.
	 *
	 * @return longitude
	 */
	public int getLongitudeE6()
	{
		return (int) (longitude * 1E6);<commit_msg>Inline setLatitude and setLongitude<commit_after>package cgeo.geocaching.geopoint;

import android.location.Location;

/**
 * Abstraction of geographic point.
 */
public final class Geopoint
{
	public static final double kmInMiles = 1 / 1.609344;
	public static final double deg2rad   = Math.PI / 180;
	public static final double rad2deg   = 180 / Math.PI;
	public static final float  erad      = 6371.0f;

	private final double latitude;
	private final double longitude;

	/**
	 * Creates new Geopoint with given latitude and longitude (both degree).
	 *
	 * @param lat latitude
	 * @param lon longitude
	 */
	public Geopoint(final double lat, final double lon)
	{
		if (lat <= 90 && lat >= -90) {
			latitude  = lat;
		} else {
			throw new MalformedCoordinateException("malformed latitude: " + lat);
		}
		if (lon <= 180 && lon >=-180) {
			longitude = lon;
		} else {
			throw new MalformedCoordinateException("malformed longitude: " + lon);
		}
	}

	/**
	 * Creates new Geopoint with given latitude and longitude (both microdegree).
	 *
	 * @param lat latitude
	 * @param lon longitude
	 */
	public Geopoint(final int lat, final int lon)
	{
		this(lat / 1e6, lon / 1e6);
	}

	/**
	 * Creates new Geopoint with latitude and longitude parsed from string.
	 *
	 * @param text string to parse
	 * @see GeopointParser.parse()
	 */
	public Geopoint(final String text)
	{
		this(GeopointParser.parseLatitude(text), GeopointParser.parseLongitude(text));
	}

	/**
	 * Creates new Geopoint with given Location.
	 *
	 * @param gp the Location to clone
	 */
	public Geopoint(final Location loc) {
		this(loc.getLatitude(), loc.getLongitude());
	}

	/**
	 * Get latitude in degree.
	 *
	 * @return latitude
	 */
	public double getLatitude()
	{
		return latitude;
	}

	/**
	 * Get latitude in microdegree.
	 *
	 * @return latitude
	 */
	public int getLatitudeE6()
	{
		return (int) (latitude * 1E6);
	}

	/**
	 * Get longitude in degree.
	 *
	 * @return longitude
	 */
	public double getLongitude()
	{
		return longitude;
	}

	/**
	 * Get longitude in microdegree.
	 *
	 * @return longitude
	 */
	public int getLongitudeE6()
	{
		return (int) (longitude * 1E6);
{'fraction_non_alphanumeric': 0.11492178098676294, 'fraction_numerical': 0.018451664661050943, 'mean_word_length': 3.0977814297452753, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '2967907', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1590, 'n_words': 491}