public class Presenter { private boolean autoUpdateEnabled; private MapLongitude mapLongitude; private MapLatitude mapLatitude; private Longitude longitude; private Latitude latitude; public Presenter(MapLongitude mapLong, MapLatitude mapLat, Longitude longi, Latitude lati) { this.mapLongitude = mapLong; this.mapLatitude = mapLat; this.longitude = longi; this.latitude = lati; this.autoUpdateEnabled = true; // default is auto-update enabled } public void setAutoUpdateEnabled(boolean enabled) { this.autoUpdateEnabled = enabled; } public boolean isAutoUpdateEnabled() { return this.autoUpdateEnabled; } public void updateGPS(double lat2, double long2) { // Update GPS coordinates longitude.updateGPS(lat2, long2); latitude.updateGPS(lat2, long2); // If auto-update is enabled, also update map coordinates if (autoUpdateEnabled) { mapLongitude.updateLongitude(long2); mapLatitude.updateLatitude(lat2); } } // Method to manually trigger a map update public void manualUpdate() { if (!autoUpdateEnabled) { mapLongitude.updateLongitude(longitude.getValue()); mapLatitude.updateLatitude(latitude.getValue()); } } }