// Path: src/main/java/net/sf/sprockets/util/Geos.java
// public static final double LATITUDE_DEGREE_KM = 111.132;
// 
// Path: src/main/java/net/sf/sprockets/util/Geos.java
// public static final double LATITUDE_DEGREE_MI = 69.054;
// 
// Path: src/main/java/net/sf/sprockets/util/MeasureUnit.java
// public static final MeasureUnit MILE = new MeasureUnit("length", "mile");
// 
// Path: src/main/java/net/sf/sprockets/util/Geos.java
// public class Geos {
// 	/**
// 	 * Number of kilometres in one degree of latitude at 45 degrees.
// 	 *
// 	 * @since 2.2.0
// 	 */
// 	public static final double LATITUDE_DEGREE_KM = 111.132;
// 
// 	/**
// 	 * Number of miles in one degree of latitude at 45 degrees.
// 	 *
// 	 * @since 2.2.0
// 	 */
// 	public static final double LATITUDE_DEGREE_MI = 69.054;
// 
// 	private Geos() {
// 	}
// 
// 	/**
// 	 * Get the cosine of the latitude after converting it to radians. The result can be used to
// 	 * improve the accuracy of geo point distance calculations. See <a href=
// 	 * "https://web.archive.org/web/20130316112756/http://www.meridianworlddata.com/Distance-calculation.asp"
// 	 * target="_blank">Distance Calculation</a> for more information.
// 	 *
// 	 * @param latitude
// 	 *            in degrees
// 	 */
// 	public static double cos(double latitude) {
// 		return Math.cos(latitude / 57.295779579);
// 	}
// }
// 
// Path: src/main/java/net/sf/sprockets/util/MeasureUnit.java
// public class MeasureUnit {
// 	/** Constant for unit of length: kilometer */
// 	public static final MeasureUnit KILOMETER = new MeasureUnit("length", "kilometer");
// 
// 	/** Constant for unit of length: mile */
// 	public static final MeasureUnit MILE = new MeasureUnit("length", "mile");
// 
// 	private final String type;
// 	private final String subType;
// 
// 	private MeasureUnit(String type, String subType) {
// 		this.type = type;
// 		this.subType = subType;
// 	}
// 
// 	/**
// 	 * Get the type, such as "length".
// 	 */
// 	public String getType() {
// 		return type;
// 	}
// 
// 	/**
// 	 * Get the subType, such as “foot”.
// 	 */
// 	public String getSubtype() {
// 		return subType;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return 31 * type.hashCode() + subType.hashCode();
// 	}
// 
// 	@Override
// 	public boolean equals(Object rhs) {
// 		if (rhs == this) {
// 			return true;
// 		}
// 		if (!(rhs instanceof MeasureUnit)) {
// 			return false;
// 		}
// 		MeasureUnit c = (MeasureUnit) rhs;
// 		return type.equals(c.type) && subType.equals(c.subType);
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return type + "-" + subType;
// 	}
// }


import org.apache.commons.lang3.time.FastDateFormat;
import net.sf.sprockets.util.Geos;
import net.sf.sprockets.util.MeasureUnit;
import static java.text.Normalizer.Form.NFD;
import static java.util.Locale.US;
import static net.sf.sprockets.util.Geos.LATITUDE_DEGREE_KM;
import static net.sf.sprockets.util.Geos.LATITUDE_DEGREE_MI;
import static net.sf.sprockets.util.MeasureUnit.MILE;
import java.text.Normalizer;
import java.util.Locale;
import java.util.TimeZone;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
	 * Remove diacritics from the string and convert it to upper case.
	 */
	public static String normalise(String s) {
		if (sDiacritics == null) {
			sDiacritics = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
		}
		return sDiacritics.matcher(Normalizer.normalize(s, NFD)).replaceAll("").toUpperCase(US);
	}

	/**
	 * Adapted from <a href=
	 * "https://web.archive.org/web/20130316112756/http://www.meridianworlddata.com/Distance-calculation.asp"
	 * >Improved approximate distance</a>.
	 */
	private static final String sDistance = "(%s * (%s - %s)) * (%s * (%s - %s)) + "
			+ "(%s * (%s - %s) * %s) * (%s * (%s - %s) * %s) AS %s";

	/**
	 * Get a result column for the squared distance from the row coordinates to the supplied
	 * coordinates. SQLite doesn't have a square root core function, so this must be applied in Java
	 * when reading the result column value.
	 *
	 * @param latitudeCosineColumn
	 *            see {@link Geos#cos(double)}
	 * @param unit
	 *            KILOMETER or MILE
	 * @param alias
	 *            result column name
	 */
	public static String distance(String latitudeColumn, String longitudeColumn,
// Path: src/main/java/net/sf/sprockets/util/Geos.java
// public static final double LATITUDE_DEGREE_KM = 111.132;
// 
// Path: src/main/java/net/sf/sprockets/util/Geos.java
// public static final double LATITUDE_DEGREE_MI = 69.054;
// 
// Path: src/main/java/net/sf/sprockets/util/MeasureUnit.java
// public static final MeasureUnit MILE = new MeasureUnit("length", "mile");
// 
// Path: src/main/java/net/sf/sprockets/util/Geos.java
// public class Geos {
// 	/**
// 	 * Number of kilometres in one degree of latitude at 45 degrees.
// 	 *
// 	 * @since 2.2.0
// 	 */
// 	public static final double LATITUDE_DEGREE_KM = 111.132;
// 
// 	/**
// 	 * Number of miles in one degree of latitude at 45 degrees.
// 	 *
// 	 * @since 2.2.0
// 	 */
// 	public static final double LATITUDE_DEGREE_MI = 69.054;
// 
// 	private Geos() {
// 	}
// 
// 	/**
// 	 * Get the cosine of the latitude after converting it to radians. The result can be used to
// 	 * improve the accuracy of geo point distance calculations. See <a href=
// 	 * "https://web.archive.org/web/20130316112756/http://www.meridianworlddata.com/Distance-calculation.asp"
// 	 * target="_blank">Distance Calculation</a> for more information.
// 	 *
// 	 * @param latitude
// 	 *            in degrees
// 	 */
// 	public static double cos(double latitude) {
// 		return Math.cos(latitude / 57.295779579);
// 	}
// }
// 
// Path: src/main/java/net/sf/sprockets/util/MeasureUnit.java
// public class MeasureUnit {
// 	/** Constant for unit of length: kilometer */
// 	public static final MeasureUnit KILOMETER = new MeasureUnit("length", "kilometer");
// 
// 	/** Constant for unit of length: mile */
// 	public static final MeasureUnit MILE = new MeasureUnit("length", "mile");
// 
// 	private final String type;
// 	private final String subType;
// 
// 	private MeasureUnit(String type, String subType) {
// 		this.type = type;
// 		this.subType = subType;
// 	}
// 
// 	/**
// 	 * Get the type, such as "length".
// 	 */
// 	public String getType() {
// 		return type;
// 	}
// 
// 	/**
// 	 * Get the subType, such as “foot”.
// 	 */
// 	public String getSubtype() {
// 		return subType;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return 31 * type.hashCode() + subType.hashCode();
// 	}
// 
// 	@Override
// 	public boolean equals(Object rhs) {
// 		if (rhs == this) {
// 			return true;
// 		}
// 		if (!(rhs instanceof MeasureUnit)) {
// 			return false;
// 		}
// 		MeasureUnit c = (MeasureUnit) rhs;
// 		return type.equals(c.type) && subType.equals(c.subType);
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return type + "-" + subType;
// 	}
// }


// Path: src/main/java/net/sf/sprockets/sql/SQLite.java
import org.apache.commons.lang3.time.FastDateFormat;
import net.sf.sprockets.util.Geos;
import net.sf.sprockets.util.MeasureUnit;
import static java.text.Normalizer.Form.NFD;
import static java.util.Locale.US;
import static net.sf.sprockets.util.Geos.LATITUDE_DEGREE_KM;
import static net.sf.sprockets.util.Geos.LATITUDE_DEGREE_MI;
import static net.sf.sprockets.util.MeasureUnit.MILE;
import java.text.Normalizer;
import java.util.Locale;
import java.util.TimeZone;
import java.util.regex.Pattern;
import javax.annotation.Nullable;

	 * Remove diacritics from the string and convert it to upper case.
	 */
	public static String normalise(String s) {
		if (sDiacritics == null) {
			sDiacritics = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
		}
		return sDiacritics.matcher(Normalizer.normalize(s, NFD)).replaceAll("").toUpperCase(US);
	}

	/**
	 * Adapted from <a href=
	 * "https://web.archive.org/web/20130316112756/http://www.meridianworlddata.com/Distance-calculation.asp"
	 * >Improved approximate distance</a>.
	 */
	private static final String sDistance = "(%s * (%s - %s)) * (%s * (%s - %s)) + "
			+ "(%s * (%s - %s) * %s) * (%s * (%s - %s) * %s) AS %s";

	/**
	 * Get a result column for the squared distance from the row coordinates to the supplied
	 * coordinates. SQLite doesn't have a square root core function, so this must be applied in Java
	 * when reading the result column value.
	 *
	 * @param latitudeCosineColumn
	 *            see {@link Geos#cos(double)}
	 * @param unit
	 *            KILOMETER or MILE
	 * @param alias
	 *            result column name
	 */
	public static String distance(String latitudeColumn, String longitudeColumn,
			String latitudeCosineColumn, double latitude, double longitude, MeasureUnit unit,