diff --git a/src/A.java b/src/A.java new file mode 100644 index 0000000..4f7e82a --- /dev/null +++ b/src/A.java @@ -0,0 +1,14 @@ +public class A { + private C c; + private double value; + public A(C c) { + this.c = c; + } + public double getValue() { + return this.value; + } + public void updateGPS(double lat2, double long2) { + this.value = lat2; + this.c.updateLatitude(this.value); + } +} \ No newline at end of file diff --git a/src/B.java b/src/B.java new file mode 100644 index 0000000..30ec773 --- /dev/null +++ b/src/B.java @@ -0,0 +1,14 @@ +public class B { + private D d; + private double value; + public B(D d) { + this.d = d; + } + public double getValue() { + return this.value; + } + public void updateGPS(double lat2, double long2) { + this.value = long2; + this.d.updateLongitude(this.value); + } +} \ No newline at end of file diff --git a/src/C.java b/src/C.java new file mode 100644 index 0000000..4583623 --- /dev/null +++ b/src/C.java @@ -0,0 +1,9 @@ +public class C { + private double value; + public double getValue() { + return this.value; + } + public void updateLatitude(double latitude) { + this.value = latitude; + } +} \ No newline at end of file diff --git a/src/D.java b/src/D.java new file mode 100644 index 0000000..2f83e7e --- /dev/null +++ b/src/D.java @@ -0,0 +1,9 @@ +public class D { + private double value; + public double getValue() { + return this.value; + } + public void updateLongitude(double longitude) { + this.value = longitude; + } +} \ No newline at end of file diff --git a/src/Map.java b/src/Map.java index abfd465..29e76ff 100644 --- a/src/Map.java +++ b/src/Map.java @@ -1,30 +1,61 @@ -import java.util.*; - public class Map { - private MapLongitude mapLongitude; - private Longitude longitude; - private MapLatitude mapLatitude; - private Latitude latitude; + private D d; + private B b; + private C c; + private A a; + private Presenter presenter; + public Map() { - this.mapLongitude = new MapLongitude(); - this.longitude = new Longitude(mapLongitude); - this.mapLatitude = new MapLatitude(); - this.latitude = new Latitude(mapLatitude); + this.d = new D(); + this.b = new B(d); + this.c = new C(); + this.a = new A(c); } public double getMapLongitude() { - return mapLongitude.getValue(); + return d.getValue(); } public double getLongitude() { - return longitude.getValue(); + return b.getValue(); } public void updateGPS(double lat2, double long2) { - this.longitude.updateGPS(lat2, long2); - this.latitude.updateGPS(lat2, long2); - } + this.presenter.updateGPS(lat2, long2); + } public double getMapLatitude() { - return mapLatitude.getValue(); + return c.getValue(); } public double getLatitude() { - return latitude.getValue(); + return a.getValue(); } -} \ No newline at end of file +} + + +//import java.util.*; +// +//public class Map { +// private MapLongitude mapLongitude; +// private Longitude longitude; +// private MapLatitude mapLatitude; +// private Latitude latitude; +// public Map() { +// this.mapLongitude = new MapLongitude(); +// this.longitude = new Longitude(mapLongitude); +// this.mapLatitude = new MapLatitude(); +// this.latitude = new Latitude(mapLatitude); +// } +// public double getMapLongitude() { +// return mapLongitude.getValue(); +// } +// public double getLongitude() { +// 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(); +// } +//} \ No newline at end of file diff --git a/src/Presenter.java b/src/Presenter.java new file mode 100644 index 0000000..3bb9e82 --- /dev/null +++ b/src/Presenter.java @@ -0,0 +1,30 @@ +// Presenter �N���X�̒lj� +public class Presenter { + private boolean autoUpdateEnabled = true; // �f�t�H���g�͎����X�VON + private C mapLatitude; + private D mapLongitude; + + public Presenter(C mapLatitude, D mapLongitude) { + this.mapLatitude = mapLatitude; + this.mapLongitude = mapLongitude; + } + + public void setAutoUpdateEnabled(boolean enabled) { + this.autoUpdateEnabled = enabled; + } + + public void updateGPS(double lat, double lon) { + // �ܓx�o�x�I�u�W�F�N�g�͏�ɍX�V + // �n�}�̒��S�ʒu�͎����X�V��ON�̏ꍇ�̂ݍX�V + if (autoUpdateEnabled) { + mapLatitude.updateLatitude(lat); + mapLongitude.updateLongitude(lon); + } + } + + // ���[�U�[���蓮�ōX�V���s�������ꍇ�Ɏg�����\�b�h + public void manualUpdate(double lat, double lon) { + mapLatitude.updateLatitude(lat); + mapLongitude.updateLongitude(lon); + } +} \ No newline at end of file