package crimereport.crimes;

public class CrimeBuilder {

	public final String title;
	public final String message;

	public Double latitude;
	public Double longitude;

	public CrimeBuilder(String title, String message) {
		this.title = title;
		this.message = message;
	}

	public CrimeBuilder setCoordinate(double latitude, double longitude) {
		this.latitude = latitude;
		this.longitude = longitude;
		return this;
	}

	public Crime build() {
		Crime crime = new Crime();

		crime.setTitle(title);
		crime.setMessage(message);

		setGeometry(crime);

		return crime;
	}

	private void setGeometry(Crime crime) {
		if (latitude == null || longitude == null) {
			return;
		}

		Geometry point = new Geometry();
		double[] coordinates = new double[2];
		coordinates[0] = longitude;
		coordinates[1] = latitude;
		point.setCoordinates(coordinates);
		crime.setGeometry(point);
	}
}

@@ -763,27 +763,26 @@
 nates%5B0%5D = l
-ong
+at
 itude;%0A%09%09coo
@@ -792,26 +792,27 @@
 nates%5B1%5D = l
-at
+ong
 itude;%0A%09%09poi

correct order of latitude and longitude