diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/src/Latitude.java b/src/Latitude.java index d9f9f3b..f1716a0 100644 --- a/src/Latitude.java +++ b/src/Latitude.java @@ -1,16 +1,12 @@ import java.util.*; public class Latitude { - private MapLatitude mapLatitude; private double value; - public Latitude(MapLatitude mapLatitude) { - this.mapLatitude = mapLatitude; - } public double getValue() { return this.value; } - public void updateGPS(double lat2, double long2) { + public double updateGPS(double lat2, double long2) { this.value = lat2; - this.mapLatitude.updateLatitude(this.value); + return this.value; } } \ No newline at end of file diff --git a/src/Longitude.java b/src/Longitude.java index b533c8a..032283a 100644 --- a/src/Longitude.java +++ b/src/Longitude.java @@ -1,16 +1,12 @@ import java.util.*; public class Longitude { - private MapLongitude mapLongitude; private double value; - public Longitude(MapLongitude mapLongitude) { - this.mapLongitude = mapLongitude; - } public double getValue() { return this.value; } - public void updateGPS(double lat2, double long2) { + public double updateGPS(double lat2, double long2) { this.value = long2; - this.mapLongitude.updateLongitude(this.value); + return this.value; } } \ No newline at end of file diff --git a/src/Map.java b/src/Map.java index abfd465..82489d5 100644 --- a/src/Map.java +++ b/src/Map.java @@ -1,15 +1,23 @@ import java.util.*; public class Map { - private MapLongitude mapLongitude; - private Longitude longitude; private MapLatitude mapLatitude; private Latitude latitude; + private MapLongitude mapLongitude; + private Longitude longitude; + private Presenter presenter; public Map() { - this.mapLongitude = new MapLongitude(); - this.longitude = new Longitude(mapLongitude); this.mapLatitude = new MapLatitude(); - this.latitude = new Latitude(mapLatitude); + this.latitude = new Latitude(); + this.mapLongitude = new MapLongitude(); + this.longitude = new Longitude(); + this.presenter = new Presenter(longitude, latitude, mapLongitude, mapLatitude); + } + public double getMapLatitude() { + return mapLatitude.getValue(); + } + public double getLatitude() { + return latitude.getValue(); } public double getMapLongitude() { return mapLongitude.getValue(); @@ -18,13 +26,6 @@ return longitude.getValue(); } public void updateGPS(double lat2, double long2) { - this.longitude.updateGPS(lat2, long2); - this.latitude.updateGPS(lat2, long2); - } - public double getMapLatitude() { - return mapLatitude.getValue(); - } - public double getLatitude() { - return latitude.getValue(); + this.presenter.updateGPS(lat2, long2); } } \ No newline at end of file diff --git a/src/Presenter.java b/src/Presenter.java new file mode 100644 index 0000000..9ecf8a6 --- /dev/null +++ b/src/Presenter.java @@ -0,0 +1,20 @@ +import java.util.*; + +public class Presenter { + private Longitude longitude; + private Latitude latitude; + private MapLongitude mapLongitude; + private MapLatitude mapLatitude; + public Presenter(Longitude longitude, Latitude latitude, MapLongitude mapLongitude, MapLatitude mapLatitude) { + this.longitude = longitude; + this.latitude = latitude; + this.mapLongitude = mapLongitude; + this.mapLatitude = mapLatitude; + } + public void updateGPS(double lat2, double long2) { + double longitude = this.longitude.updateGPS(lat2, long2); + double latitude = this.latitude.updateGPS(lat2, long2); + this.mapLongitude.updateLongitude(longitude); + this.mapLatitude.updateLatitude(latitude); + } +} \ No newline at end of file